Property | Type | Description | |
---|---|---|---|
$features | of strings $features. An array of the features that limit the behaviour of the vocabulary. Default values can include: hierarchical: The vocabulary's terms exist in a parent child hierarchy required: multiple: More than one term in the vocabulary can be associated with an object free: Terms within the vocabulary can have any value unique: A term may be associated with exactly 0 or 1 object |
Method | Description | |
---|---|---|
__construct ( array $paramarray = [] ) | Vocabulary constructor Creates a Vocabulary instance | |
__get ( $name ) : mixed | function __get Overrides QueryRecord __get to implement custom object properties | |
add_object_type ( $type ) : none | inserts a new object type into the database, if it doesn't exist | |
add_term ( $term, $target_term = null, $before = false ) : |
Adds a term to the vocabulary. Returns a Term object. null parameters append the term to the end of any hierarchies. | |
count_total ( ) : integer | Returns the number of tags in the database. | |
create ( array $paramarray ) : |
Create a vocabulary and save it. | |
default_fields ( ) : array | Return the defined database columns for a Vocabulary. | |
delete ( ) | Delete an existing vocabulary | |
delete_term ( |
Remove the term from the vocabulary. Convenience method to ->get_term('foo')->delete(). | |
exists ( string $name ) : boolean | Determine whether a vocabulary exists | |
get ( $name ) : |
Return a Vocabulary by name. | |
get_all ( ) : array | Return all vocabularies as Vocabulary objects | |
get_all_object_terms ( $object_type, $id ) : array | Return the Term objects associated to that type of object with that id in any vocabulary. | |
get_associations ( $object_id, $object_type = 'post' ) : |
Get the tags associated with this object | |
get_by_id ( integer $id ) : |
Return a Vocabulary by id | |
get_object_terms ( String $object_type, integer $id ) : Array | Gets the Term objects associated to that type of object with that id in this vocabulary For example, return all terms in this vocabulary that are associated with a particular post | |
get_options ( ) : Array | Retrieve the vocabulary as an associative array suitable for FormUI select controls | |
get_root_terms ( ) : Array | Get all root elements in this vocabulary | |
get_search ( string $search, $orderby = 'mptt_left ASC' ) : |
Retrieve the terms in the vocabulary that match the specified criteria | |
get_term ( |
Gets the term object by id. No parameter returns the root Term object. | |
get_tree ( $orderby = 'mptt_left ASC' ) : |
Retrieve the vocabulary | |
insert ( ) | function insert Saves a new vocabulary to the vocabularies table | |
is_empty ( ) | Check if this vocabulary is empty. | |
max_count ( ) : integer | Returns the number of times the most used tag is used. | |
merge ( mixed $master, Array $tags, $object_type = 'post' ) | Renames terms. | |
min_count ( ) : integer | Returns the number of times the least used tag is used. | |
move_term ( |
Moves a term within the vocabulary. Returns a Term object. null parameters append the term to the end of any hierarchies. | |
names ( ) : array | Return the names of all vocabularies | |
object_type_id ( $type ) : integer | Return the object type id for a named object, such as a post | |
post_count ( mixed $term, $object_type = 'post' ) : integer | Returns the count of times a tag is used. | |
prep_update ( |
Moves all of the terms into a temporary area so that they can be moved | |
rename ( $newname ) : boolean | Rename a Vocabulary. | |
search_term ( string $term, string $term_class = '\Habari\Term' ) : |
Search for matching term objects. | |
set_object_terms ( String $object_type, integer $id, Array $terms = [] ) : boolean. | Sets the Term objects associated to that type of object with that id in this vocabulary | |
update ( ) | function update Updates an existing vocabulary in the vocabularies table |
public __construct ( array $paramarray = [] ) | ||
$paramarray | array | an associative array of initial vocabulary values |
public static add_object_type ( $type ) : none | ||
return | none |
public add_term ( $term, $target_term = null, $before = false ) : |
||
return | The Term object added |
public count_total ( ) : integer | ||
return | integer | The number of tags in the database. |
public static default_fields ( ) : array | ||
return | array | Array of columns in the Vocabulary table |
public delete_term ( |
||
$term | The term to delete |
public static get ( $name ) : |
||
return | The requested vocabulary |
public static get_all_object_terms ( $object_type, $id ) : array | ||
return | array | Array of Vocabulary names |
public get_associations ( $object_id, $object_type = 'post' ) : |
||
return | The terms associated with this object |
public get_object_terms ( String $object_type, integer $id ) : Array | ||
$object_type | String | the name of the object type |
$id | integer | The id of the object for which you want the terms |
return | Array | The Term objects requested |
public get_options ( ) : Array | ||
return | Array | The Term objects in the vocabulary, in tree order |
public get_root_terms ( ) : Array | ||
return | Array | The root Term objects in the vocabulary |
public get_search ( string $search, $orderby = 'mptt_left ASC' ) : |
||
$search | string | The string to search for |
return | The Term objects that match the search term |
public get_term ( |
||
$term | A Term object, null (for the first node in the tree), a string (for a term slug or display), or an integer (for a Term ID). | |
$term_class | string | The class of the returned term object. |
return | The Term object requested |
public get_tree ( $orderby = 'mptt_left ASC' ) : |
||
return | The Term objects in the vocabulary, in tree order |
public insert ( ) |
public move_term ( |
||
$term | The term to move. | |
$target_term | The term to move $term before or after, or null to move it to the very end of the vocabulary. | |
$before | boolean | True to move $term BEFORE $target_term, false (the default) to move $term AFTER $target_term. |
return | The Term object moved |
public static object_type_id ( $type ) : integer | ||
return | integer | The id of the object type |
public post_count ( mixed $term, $object_type = 'post' ) : integer | ||
$term | mixed | The tag to count usage. |
return | integer | The number of times a tag is used. |
public static prep_update ( |
||
$terms | An array of Term objects |
public search_term ( string $term, string $term_class = '\Habari\Term' ) : |
||
$term | string | The string to search for as a term slug or text |
$term_class | string | The class of the returned term object. |
return | The matching Term objects |
public set_object_terms ( String $object_type, integer $id, Array $terms = [] ) : boolean. | ||
$object_type | String | the name of the object type |
$id | integer | The id of the object for which you want the terms |
$terms | Array | The names of the terms to associate |
return | boolean. |
public update ( ) |
public static $features |