PHP Class Habari\Terms

Inheritance: extends ArrayObject, implements habari\FormStorage
Mostrar archivo Open project: habari/system

Public Methods

Method Description
field_load ( string $key ) : mixed Loads form values from an object
field_save ( string $key, mixed $value ) Stores a form value into the object
has ( $tags ) : boolean. See if a term or set of terms is in this set of terms
parse ( mixed $terms, string $term_class = '\Habari\Term', Vocabulary $vocabulary = null ) : Terms Turns a comma-separated string or array of terms into an array of Term objects
tree_sort ( $sort_fn = null ) : Terms Sort the term objects by mptt_left ASC to put them in tree order

Method Details

field_load() public method

Loads form values from an object
public field_load ( string $key ) : mixed
$key string The name of a form component that will be loaded
return mixed The stored value returned

field_save() public method

Stores a form value into the object
public field_save ( string $key, mixed $value )
$key string The name of a form component that will be stored
$value mixed The value of the form component to store

has() public method

See if a term or set of terms is in this set of terms
public has ( $tags ) : boolean.
return boolean.

parse() public static method

Turns a comma-separated string or array of terms into an array of Term objects
public static parse ( mixed $terms, string $term_class = '\Habari\Term', Vocabulary $vocabulary = null ) : Terms
$terms mixed A comma-separated string or array of string terms
$term_class string The class of the Term object type to create from each string
$vocabulary Vocabulary An instance of the Vocabulary that might hold the terms. Use existing term object data if found in the specified vocabulary.
return Terms An instance of Terms contianing the specified Term objects

tree_sort() public method

Sort the term objects by mptt_left ASC to put them in tree order
public tree_sort ( $sort_fn = null ) : Terms
return Terms A sorted Terms instance