Options
        
        extends Ext
    
    
            
            in package
            
        
    
    
    
        
            The Options class provides a convenient method of specifying where Editor should get the list of options for a `select`, `radio` or `checkbox` field.
This is normally from a table that is left joined to the main table being edited, and a list of the values available from the joined table is shown to the end user to let them select from.
Options instances are used with the Field->options() method.
Tags
Table of Contents
- add() : Options
 - Add extra options to the list, in addition to any obtained from the database.
 - inst() : Editor|Field|Join|Upload
 - Static method to instantiate a new instance of a class (shorthand of 'instantiate').
 - instantiate() : Editor|Field|Join|Upload
 - Static method to instantiate a new instance of a class.
 - label() : Options|array<string|int, string>
 - Get / set the column(s) to use as the label value of the options.
 - leftJoin() : self
 - Set up a left join operation for the options.
 - limit() : Options|array<string|int, string>
 - Get / set the LIMIT clause to limit the number of records returned.
 - order() : Options|string
 - Get / set the ORDER BY clause to use in the SQL. If this option is not provided the ordering will be based on the rendered output, either numerically or alphabetically based on the data returned by the renderer.
 - render() : Options|callable
 - Get / set the label renderer. The renderer can be used to combine multiple database columns into a single string that is shown as the label to the end user in the list of options.
 - table() : Options|string
 - Get / set the database table from which to gather the options for the list.
 - value() : Options|string
 - Get / set the column name to use for the value in the options list. This would normally be the primary key for the table.
 - where() : Options|callable
 - Get / set the method to use for a WHERE condition if it is to be applied to the query to get the options.
 - _getSet() : self|mixed
 - Common getter / setter function for DataTables classes.
 - _propExists() : bool
 - Determine if a property is available in a data set (allowing `null` to be a valid value).
 - _readProp() : mixed
 - Read a value from a data structure, using Javascript dotted object notation. This is the inverse of the `_writeProp` method and provides the same support, matching DataTables' ability to read nested JSON data objects.
 - _writeProp() : mixed
 - Write the field's value to an array structure, using Javascript dotted object notation to indicate JSON data structure. For example `name.first` gives the data structure: `name: { first: ... }`. This matches DataTables own ability to do this on the client-side, although this doesn't implement implement quite such a complex structure (no array / function support).
 
Methods
add()
Add extra options to the list, in addition to any obtained from the database.
    public
                    add(string $label[, string|null $value = null ]) : Options
    
        Parameters
- $label : string
 - 
                    
The label to use for the option
 - $value : string|null = null
 - 
                    
Value for the option. If not given, the label will be used
 
Return values
Options —Self for chaining
inst()
Static method to instantiate a new instance of a class (shorthand of 'instantiate').
    public
            static        inst() : Editor|Field|Join|Upload
        This method performs exactly the same actions as the 'instantiate' static method, but is simply shorter and easier to type!
Tags
Return values
Editor|Field|Join|Upload —class
instantiate()
Static method to instantiate a new instance of a class.
    public
            static        instantiate() : Editor|Field|Join|Upload
        A factory method that will create a new instance of the class that has extended 'Ext'. This allows classes to be instantiated and then chained - which otherwise isn't available until PHP 5.4. If using PHP 5.4 or later, simply create a 'new' instance of the target class and chain methods as normal.
Tags
Return values
Editor|Field|Join|Upload —Instantiated class
label()
Get / set the column(s) to use as the label value of the options.
    public
                    label([string|array<string|int, string>|null $_ = null ]) : Options|array<string|int, string>
    
        Parameters
- $_ : string|array<string|int, string>|null = null
 - 
                    
null to get the current value, string or array to get.
 
Return values
Options|array<string|int, string> —Self if setting for chaining, array of values if getting.
leftJoin()
Set up a left join operation for the options.
    public
                    leftJoin(string $table, string $field1, string $operator, string $field2) : self
    
        Parameters
- $table : string
 - 
                    
to get the information from
 - $field1 : string
 - 
                    
the first field to get the information from
 - $operator : string
 - 
                    
the operation to perform on the two fields
 - $field2 : string
 - 
                    
the second field to get the information from
 
Return values
self —limit()
Get / set the LIMIT clause to limit the number of records returned.
    public
                    limit([number|null $_ = null ]) : Options|array<string|int, string>
    
        Parameters
- $_ : number|null = null
 - 
                    
Number of rows to limit the result to
 
Return values
Options|array<string|int, string> —Self if setting for chaining, limit if getting.
order()
Get / set the ORDER BY clause to use in the SQL. If this option is not provided the ordering will be based on the rendered output, either numerically or alphabetically based on the data returned by the renderer.
    public
                    order([string|null $_ = null ]) : Options|string
    
        Parameters
- $_ : string|null = null
 - 
                    
String to set, null to get current value
 
Return values
Options|string —Self if setting for chaining, string if getting.
render()
Get / set the label renderer. The renderer can be used to combine multiple database columns into a single string that is shown as the label to the end user in the list of options.
    public
                    render([callable|null $_ = null ]) : Options|callable
    
        Parameters
- $_ : callable|null = null
 - 
                    
Function to set, null to get current value
 
Return values
Options|callable —Self if setting for chaining, callable if getting.
table()
Get / set the database table from which to gather the options for the list.
    public
                    table([string|null $_ = null ]) : Options|string
    
        Parameters
- $_ : string|null = null
 - 
                    
String to set, null to get current value
 
Return values
Options|string —Self if setting for chaining, string if getting.
value()
Get / set the column name to use for the value in the options list. This would normally be the primary key for the table.
    public
                    value([string|null $_ = null ]) : Options|string
    
        Parameters
- $_ : string|null = null
 - 
                    
String to set, null to get current value
 
Return values
Options|string —Self if setting for chaining, string if getting.
where()
Get / set the method to use for a WHERE condition if it is to be applied to the query to get the options.
    public
                    where([callable|null $_ = null ]) : Options|callable
    
        Parameters
- $_ : callable|null = null
 - 
                    
Function to set, null to get current value
 
Return values
Options|callable —Self if setting for chaining, callable if getting.
_getSet()
Common getter / setter function for DataTables classes.
    protected
                    _getSet(mixed &$prop, mixed $val[, bool $array = false ]) : self|mixed
        This getter / setter method makes building getter / setting methods easier, by abstracting everything to a single function call.
Parameters
- $prop : mixed
 - 
                    
The property to set
 - $val : mixed
 - 
                    
The value to set - if given as null, then we assume that the function is being used as a getter.
 - $array : bool = false
 - 
                    
Treat the target property as an array or not (default false). If used as an array, then values passed in are added to the $prop array.
 
Return values
self|mixed —Class instance if setting (allowing chaining), or the value requested if getting.
_propExists()
Determine if a property is available in a data set (allowing `null` to be a valid value).
    protected
                    _propExists(string $name, array<string|int, mixed> $data) : bool
    
        Parameters
- $name : string
 - 
                    
Javascript dotted object name to write to
 - $data : array<string|int, mixed>
 - 
                    
Data source array to read from
 
Tags
Return values
bool —true if present, false otherwise
_readProp()
Read a value from a data structure, using Javascript dotted object notation. This is the inverse of the `_writeProp` method and provides the same support, matching DataTables' ability to read nested JSON data objects.
    protected
                    _readProp(string $name, array<string|int, mixed> $data) : mixed
    
        Parameters
- $name : string
 - 
                    
Javascript dotted object name to write to
 - $data : array<string|int, mixed>
 - 
                    
Data source array to read from
 
Tags
Return values
mixed —The read value, or null if no value found.
_writeProp()
Write the field's value to an array structure, using Javascript dotted object notation to indicate JSON data structure. For example `name.first` gives the data structure: `name: { first: ... }`. This matches DataTables own ability to do this on the client-side, although this doesn't implement implement quite such a complex structure (no array / function support).
    protected
                    _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed
    
        Parameters
- $out : array<string|int, mixed>
 - 
                    
Array to write the data to
 - $name : string
 - 
                    
Javascript dotted object name to write to
 - $value : mixed
 - 
                    
Value to write