Fieldmanager_Datasource
class Fieldmanager_Datasource (View source)
Datasource base class to populate autocomplete and option fields.
This class can be used as an arbitrary data source for static options, or it can be extended to provide custom data sources.
Properties
array | $options | The datasource options. |
|
string | $options_callback | Options callback. |
|
bool | $use_ajax | Whether or not to use Ajax. |
|
bool | $allow_optgroups | Allow option groups. |
|
string | $ajax_action | The Ajax action. |
|
static int | $counter | Counter to create uniquely named Ajax actions. |
|
bool | $grouped | If true, group elements. |
Methods
Constructor.
Get the value of an item; most clearly used by Post and Term, which take database IDs and return user-friendly titles.
Get available options, optionally filtering by a fragment (e.g. for Autocomplete).
Get an action to register by hashing (non cryptographically for speed) the options that make this datasource unique.
Format items for use in Ajax.
Ajax callback to find posts.
Trigger to handle actions needed before saving data.
Modify values before rendering editor.
Datasource handles sanitization and validation.
Get view link, not used here but meant for override.
Get edit link, not used here but meant for override.
Details
__construct(array $options = array())
Constructor.
string
get_value(int $id)
Get the value of an item; most clearly used by Post and Term, which take database IDs and return user-friendly titles.
array
get_items(string $fragment = null)
Get available options, optionally filtering by a fragment (e.g. for Autocomplete).
string
get_ajax_action()
Get an action to register by hashing (non cryptographically for speed) the options that make this datasource unique.
get_items_for_ajax(string|null $fragment = null)
Format items for use in Ajax.
autocomplete_search()
Ajax callback to find posts.
string
presave_alter_values(Fieldmanager_Field $field, mixed $values, mixed $current_values)
Trigger to handle actions needed before saving data.
array
preload_alter_values(Fieldmanager_Field $field, mixed $values)
Modify values before rendering editor.
string
presave(Fieldmanager_Field $field, mixed $value, mixed $current_value)
Datasource handles sanitization and validation.
string
get_view_link(mixed $value)
Get view link, not used here but meant for override.
string
get_edit_link(int|string $value)
Get edit link, not used here but meant for override.