PHP Class WPLib_Term_Model_Base, wplib

The Model Base Class for Terms
Inheritance: extends WPLib_Model_Base
Show file Open project: wplib/wplib

Public Methods

Method Description
__construct ( object | integer | string | null $term, array $args = [] )
assign ( integer $object_id ) : int[] | WP_Error Associate the passed Object ID with this taxonomy term.
has_term ( ) : boolean Check to see if this instance has a valid term object in $_term property.
is_assigned ( integer $object_id ) : boolean | WP_Error Is the passed Object ID associated with this taxonomy term.
item_class ( ) : mixed Return the item class name defined for this model.
item_taxonomy ( ) : mixed | null Returns the TAXONOMY value for this model's item.
make_new ( array $args ) : WPLib_Term_Model_Base
object_ids ( ) : array | WP_Error Return array of object IDs associate with this taxonomy term.
permalink ( ) : string | WP_Error
set_term ( object $term ) : mixed | WP_Term | object
taxonomy ( )
term ( ) : WP_Term | object | null
term_description ( ) : string
term_id ( ) : integer
term_name ( ) : null | string
term_slug ( ) : null | string
unassign ( integer $object_id ) : boolean | WP_Error Associate the passed Object ID with this taxonomy term.
update_description ( string $new_description )
update_field ( string $field_name, string $new_value )
update_slug ( string $new_slug )

Method Details

__construct() public method

public __construct ( object | integer | string | null $term, array $args = [] )
$term object | integer | string | null
$args array

assign() public method

Associate the passed Object ID with this taxonomy term.
public assign ( integer $object_id ) : int[] | WP_Error
$object_id integer Likely a Post ID but can be other things
return int[] | WP_Error

has_term() public method

Check to see if this instance has a valid term object in $_term property.
public has_term ( ) : boolean
return boolean

is_assigned() public method

Is the passed Object ID associated with this taxonomy term.
public is_assigned ( integer $object_id ) : boolean | WP_Error
$object_id integer Likely a Post ID but can be other things
return boolean | WP_Error

item_class() static public method

Assumes the Model class name is simply the Item class name with '_Model' on the end. App_Foo -> App_Foo_Model
static public item_class ( ) : mixed
return mixed

item_taxonomy() static public method

Returns the TAXONOMY value for this model's item.
static public item_taxonomy ( ) : mixed | null
return mixed | null

make_new() static public method

static public make_new ( array $args ) : WPLib_Term_Model_Base
$args array
return WPLib_Term_Model_Base

object_ids() public method

Return array of object IDs associate with this taxonomy term.
public object_ids ( ) : array | WP_Error
return array | WP_Error

set_term() public method

public set_term ( object $term ) : mixed | WP_Term | object
$term object
return mixed | WP_Term | object

taxonomy() public method

public taxonomy ( )

term() public method

public term ( ) : WP_Term | object | null
return WP_Term | object | null

term_description() public method

public term_description ( ) : string
return string

term_id() public method

public term_id ( ) : integer
return integer

term_name() public method

public term_name ( ) : null | string
return null | string

term_slug() public method

public term_slug ( ) : null | string
return null | string

unassign() public method

Associate the passed Object ID with this taxonomy term.
public unassign ( integer $object_id ) : boolean | WP_Error
$object_id integer Likely a Post ID but can be other things
return boolean | WP_Error

update_description() public method

public update_description ( string $new_description )
$new_description string

update_field() public method

public update_field ( string $field_name, string $new_value )
$field_name string
$new_value string

update_slug() public method

public update_slug ( string $new_slug )
$new_slug string