Fieldmanager_Datasource_Term
class Fieldmanager_Datasource_Term extends Fieldmanager_Datasource (View source)
Datasource to populate autocomplete and option fields with WordPress terms.
Properties
array | $options | The datasource options. |
from Fieldmanager_Datasource |
string | $options_callback | Options callback. |
from Fieldmanager_Datasource |
bool | $use_ajax | Build this datasource using Ajax. |
|
bool | $allow_optgroups | Allow option groups. |
from Fieldmanager_Datasource |
string | $ajax_action | The Ajax action. |
from Fieldmanager_Datasource |
static int | $counter | Counter to create uniquely named Ajax actions. |
from Fieldmanager_Datasource |
bool | $grouped | If true, group elements. |
from Fieldmanager_Datasource |
string|array | $taxonomy | Taxonomy name or array of taxonomy names. |
|
array | $taxonomy_args | Helper for taxonomy-based option sets; arguments to find terms. |
|
bool | $taxonomy_hierarchical | Sort taxonomy hierarchically and indent child categories with dashes? |
|
int | $taxonomy_hierarchical_depth | How far to descend into taxonomy hierarchy (0 for no limit). |
|
bool | $append_taxonomy | Pass $append = true to wp_set_object_terms? |
|
string | $taxonomy_save_to_terms | If true, additionally save taxonomy terms to WP's terms tables. |
|
string | $only_save_to_taxonomy | If true, only save this field to the taxonomy tables, and do not serialize in the FM array. |
|
bool | $store_term_taxonomy_id | If true, store the term_taxonomy_id instead of the term_id. |
Methods
Constructor.
Translate term id to title, e.g. for autocomplete.
Get taxonomy data per $this->taxonomy_args.
Get an action to register by hashing (non cryptographically for speed) the options that make this datasource unique.
Format items for use in Ajax.
Presave hook to set taxonomy data.
Unique among FM types, the taxonomy datasource can store data outside FM's array.
Get link to view a term.
Get link to edit a term.
Get taxonomies; normalizes $this->taxonomy to an array.
Helper to support recursive building of a hierarchical taxonomy list.
Details
__construct(array $options = array())
Constructor.
string
get_value(mixed $value)
Translate term id to title, e.g. for autocomplete.
array
get_items(string $fragment = null)
Get taxonomy data per $this->taxonomy_args.
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)
Presave hook to set taxonomy data.
array
preload_alter_values(Fieldmanager_Field $field, mixed $values)
Unique among FM types, the taxonomy datasource can store data outside FM's array.
This is how we add it back into the array for editing.
string
presave(Fieldmanager_Field $field, mixed $value, mixed $current_value)
Sanitize a value.
string
get_view_link(mixed $value)
Get link to view a term.
string
get_edit_link(int|string $value)
Get link to edit a term.
array
get_taxonomies()
Get taxonomies; normalizes $this->taxonomy to an array.
bool
sort_terms(WP_Term $term_a, WP_Term $term_b)
deprecated
deprecated
Sort function for get_the_terms
result set.
pre_save_taxonomy(mixed $tax_values, Fieldmanager_Field $field)
Save taxonomy data.
protected array
build_hierarchical_term_data(array $parent_terms, array $tax_args, int $depth, array $stack = array(), string $pattern = '')
Helper to support recursive building of a hierarchical taxonomy list.