Settings
Handles utility functions for the settings page.
Tags
Table of Contents
- array_splice_after_key() : array<string|int, mixed>
 - Place an array at a given position.
 - delete_option() : bool
 - Removes a setting value in the database.
 - get_filter_sources_list() : array<string|int, mixed>
 - Get the list of sources that filters are allowed to pick from.
 - get_groups_for_dropdown() : array<string|int, mixed>
 - Get an array of filter groups ( id => name ).
 - get_option() : mixed
 - Get an option Looks to see if the specified setting exists, returns default if not.
 - get_supported_filter_types_list() : array<string|int, mixed>
 - Get the list of supported filter types for the "Filter type" setting within the filters editor.
 - is_or_logic_enabled() : bool
 - Determine if the "OR" logic is enabled.
 - parse_array_for_select_control() : array<string|int, mixed>
 - Prepare a key => value array to be used within the SelectControl react component.
 - update_option() : bool
 - Update an option.
 
Methods
array_splice_after_key()
Place an array at a given position.
    public
            static    array_splice_after_key(array<string|int, mixed> $array, string $key, array<string|int, mixed> $array_to_insert) : array<string|int, mixed>
    
        Parameters
- $array : array<string|int, mixed>
 - $key : string
 - $array_to_insert : array<string|int, mixed>
 
Return values
array<string|int, mixed> —delete_option()
Removes a setting value in the database.
    public
            static    delete_option([string $key = '' ]) : bool
    
        Parameters
- $key : string = ''
 - 
                    
The Key to delete.
 
Return values
bool —True if removed, false if not.
get_filter_sources_list()
Get the list of sources that filters are allowed to pick from.
    public
            static    get_filter_sources_list() : array<string|int, mixed>
    
    
    
        Return values
array<string|int, mixed> —get_groups_for_dropdown()
Get an array of filter groups ( id => name ).
    public
            static    get_groups_for_dropdown([bool $disable_none = false ]) : array<string|int, mixed>
        Usually used for dropdowns.
Parameters
- $disable_none : bool = false
 - 
                    
whether or not to disable the "None" option.
 
Return values
array<string|int, mixed> —get_option()
Get an option Looks to see if the specified setting exists, returns default if not.
    public
            static    get_option([string $key = '' ][, mixed $default = false ]) : mixed
    
        Parameters
- $key : string = ''
 - 
                    
the key to retrieve.
 - $default : mixed = false
 - 
                    
default value to use in case option is not available.
 
Return values
mixed —get_supported_filter_types_list()
Get the list of supported filter types for the "Filter type" setting within the filters editor.
    public
            static    get_supported_filter_types_list() : array<string|int, mixed>
        The list also contains the type of "sources" that the field supports.
Return values
array<string|int, mixed> —is_or_logic_enabled()
Determine if the "OR" logic is enabled.
    public
            static    is_or_logic_enabled() : bool
    
    
    
        Return values
bool —parse_array_for_select_control()
Prepare a key => value array to be used within the SelectControl react component.
    public
            static    parse_array_for_select_control(array<string|int, mixed> $arr) : array<string|int, mixed>
    
        Parameters
- $arr : array<string|int, mixed>
 
Return values
array<string|int, mixed> —update_option()
Update an option.
    public
            static    update_option([string $key = '' ][, string|bool|int $value = false ][, bool $bypass_cap = false ]) : bool
        Updates an etting value in both the db and the global variable. Warning: Passing in an empty, false or null string value will remove the key from the options array.
Parameters
- $key : string = ''
 - 
                    
The Key to update.
 - $value : string|bool|int = false
 - 
                    
The value to set the key to.
 - $bypass_cap : bool = false
 - 
                    
whether or not the capability check should be bypassed.
 
Return values
bool —True if updated, false if not.