SLP_Option
extends SLPlus_BaseClass_Object
in package
A single Smart Option object that is setup via things like SLP_SmartOptions.
Remember only private properties are run through the __get(), __set(), and __isset() magic methods.
Table of Contents
Properties
- $add_to_settings_tab : bool
- $add_to_settings_tab : mixed
- $allow_empty : mixed
- $call_when_changed : mixed
- $call_when_time : null|callable
- $call_when_time : mixed
- $classes : array<string|int, mixed>
- $classes : mixed
- $default : mixed
- $default : mixed
- $description : string
- $get_item_callback : array<string|int, mixed>
- $get_items_callback : mixed
- $group : string
- $initial_value : mixed
- $is_false : bool
- $is_text : bool
- $is_text : mixed
- $is_true : bool
- $label : string
- $options : array<string|int, mixed>
- $options : mixed
- $page : string
- $related_to : string
- $related_to : mixed
- $section : string
- $show_label : bool
- $show_label : mixed
- $slplus : SLPlus
- $slug : string
- $slug : mixed
- $type : string
- $type : mixed
- $use_in_javascript : bool
- $use_in_javascript : mixed
- $uses_slplus : bool
- $value : mixed
- $slplus : mixed
- $uses_slplus : mixed
- $description : mixed
- $group : mixed
- $initial_value : mixed
- $is_false : mixed
- $is_true : mixed
- $label : mixed
- $page : mixed
- $section : mixed
- $value : mixed
Methods
- __construct() : mixed
- __get() : mixed
- Get the value, running it through a filter. "Magic method".
- __isset() : bool
- Allow isset to be called on private properties. "Magic method".
- __set() : SLP_Option|null
- Allow value to be set directly. "Magic method".
- __toString() : string
- To String. "Magic method", what to do when asked to output this object.
- get_instance() : SLPlus_BaseClass_Object
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- set_properties() : mixed
- Set our properties.
- initialize() : mixed
- Do these things when this object is invoked. Override in your class.
Properties
$add_to_settings_tab
public
bool
$add_to_settings_tab
true (default) to show on settings tab on admin panel
$add_to_settings_tab
public
mixed
$add_to_settings_tab
= \true
$allow_empty
public
mixed
$allow_empty
= \false
$call_when_changed
public
mixed
$call_when_changed
= \null
$call_when_time
public
null|callable
$call_when_time
the function to call when the cron time fires - gets $slug - executed with ->execute_cron_jobs
$call_when_time
public
mixed
$call_when_time
= \null
$classes
public
array<string|int, mixed>
$classes
an array of class strings to add to the admin render
$classes
public
mixed
$classes
= array()
$default
public
mixed
$default
default value (used if the value is empty)
$default
public
mixed
$default
= ''
$description
public
string
$description
description to show on admin settings page - via text manager
$get_item_callback
public
array<string|int, mixed>
$get_item_callback
object and method in typical array(
$get_items_callback
public
mixed
$get_items_callback
$group
public
string
$group
the slug for the settings group where the settings is displayed to admin users
$initial_value
public
mixed
$initial_value
the initial value from the SLP options
$is_false
public
bool
$is_false
is this thing false ('0' for checkbox, empty string) :: empty(value)
$is_text
public
bool
$is_text
true if a gettext translatable string
$is_text
public
mixed
$is_text
= \false
$is_true
public
bool
$is_true
is this thing true (NOT '0' for checkbox, not empty string) :: ! empty( value)
$label
public
string
$label
label to show on admin settings page - via text manager
$options
public
array<string|int, mixed>
$options
array of drop down (select) options array( array( 'label' => __() , 'value'=>'val' ) )
$options
public
mixed
$options
$page
public
string
$page
the slug for the settings page where the option setting is displayed to admin users
$related_to
public
string
$related_to
slugs for related settings
$related_to
public
mixed
$related_to
$section
public
string
$section
the slug for the settings section where the option setting is displayed to admin users
$show_label
public
bool
$show_label
true to show label on admin settings page
$show_label
public
mixed
$show_label
= \true
$slplus
public
SLPlus
$slplus
$slug
public
string
$slug
the slug
$slug
public
mixed
$slug
$type
public
string
$type
type of admin input field
$type
public
mixed
$type
= 'text'
$use_in_javascript
public
bool
$use_in_javascript
use in javascript (true: gets localized in localize_script)
$use_in_javascript
public
mixed
$use_in_javascript
= \false
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$value
public
mixed
$value
current value of option
$slplus
protected
mixed
$slplus
$uses_slplus
protected
mixed
$uses_slplus
= \true
$description
private
mixed
$description
$group
private
mixed
$group
$initial_value
private
mixed
$initial_value
$is_false
private
mixed
$is_false
$is_true
private
mixed
$is_true
$label
private
mixed
$label
$page
private
mixed
$page
$section
private
mixed
$section
$value
private
mixed
$value
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
Get the value, running it through a filter. "Magic method".
public
__get(string $property) : mixed
Parameters
- $property : string
Return values
mixed —null if not set or the value
__isset()
Allow isset to be called on private properties. "Magic method".
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
bool__set()
Allow value to be set directly. "Magic method".
public
__set( $property, $value) : SLP_Option|null
Parameters
Return values
SLP_Option|null__toString()
To String. "Magic method", what to do when asked to output this object.
public
__toString() : string
..
Return values
string —mixed
get_instance()
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
public
static get_instance([bool $no_global = false ][, mixed $params = array() ]) : SLPlus_BaseClass_Object
TODO: PHP7.4 and PHP8.0 the static instance variable returns an object matching $class TODO: PHP8.1 the static instance continually returns the FIRST object (SLP_Admin_Helper) every time -- it is like PHP8.1 static instance is bound to base_class-object versus the calling class object
Parameters
- $no_global : bool = false
-
set to true to skip assigning object to SLP global as a property.
- $params : mixed = array()
-
object init params
Return values
SLPlus_BaseClass_Objectset_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
initialize()
Do these things when this object is invoked. Override in your class.
protected
initialize() : mixed