PHP Class Themosis\Taxonomy\TaxField

Allow the user to add custom fields to a taxonomy.
显示文件 Open project: themosis/framework

Public Methods

Method Description
addFields ( ) Display the custom fields on the add terms page.
check ( ) Check if the taxonomy exists. Call by the action hook 'wp_loaded'.
delete ( integer $term_id ) Delete the fields from the database.
editFields ( stdClass $term ) Display the custom fields on the edit term page.
make ( string $taxonomySlug ) : TaxField Init the custom taxonomy field.
save ( integer $term_id ) Save the fields values in the options table.
set ( array $fields ) : TaxField Set the custom fields for the taxonomy.

Private Methods

Method Description
__construct ( string $taxonomySlug ) The TaxField constructor.
parse ( array $fields, string $taxonomySlug ) : array Parse the fields and mix them with a default one.

Method Details

addFields() public method

Display the custom fields on the add terms page.
public addFields ( )

check() public method

If not, throw an exception.
public check ( )

delete() public method

Delete the fields from the database.
public delete ( integer $term_id )
$term_id integer The term ID.

editFields() public method

Display the custom fields on the edit term page.
public editFields ( stdClass $term )
$term stdClass The term object passed by WordPress.

make() public static method

Init the custom taxonomy field.
public static make ( string $taxonomySlug ) : TaxField
$taxonomySlug string The taxonomy slug.
return TaxField

save() public method

Save the fields values in the options table.
public save ( integer $term_id )
$term_id integer The term ID.

set() public method

Set the custom fields for the taxonomy.
public set ( array $fields ) : TaxField
$fields array A list of fields.
return TaxField