PHP Class Themosis\Taxonomy\TaxonomyBuilder

Inheritance: extends Themosis\Field\Wrapper
Afficher le fichier Open project: themosis/framework

Protected Properties

Свойство Type Description
$action Themosis\Hook\IHook
$container Themosis\Foundation\Application
$datas Themosis\Foundation\DataContainer Store the taxonomy data.
$fields array The taxonomy custom fields.
$prefix string
$validator Themosis\Validation\ValidationBuilder
$view Illuminate\View\Factory

Méthodes publiques

Méthode Description
__construct ( Application $container, DataContainer $datas, Themosis\Hook\IHook $action, ValidationBuilder $validator, Illuminate\View\Factory $view ) Build a TaxonomyBuilder instance.
addFields ( array $fields, string $taxonomy = '' ) : TaxonomyBuilder Register/display taxonomy custom fields.
bind ( ) : TaxonomyBuilder Link the taxonomy to its custom post type. Allow the taxonomy to be found in 'parse_query' or 'pre_get_posts' filters.
displayAddFields ( ) Display fields on add form screen.
displayEditFields ( stdClass $term ) Display fields on edit form screen.
get ( null $property = null ) : array Return a defined taxonomy property.
make ( string $name, string | array $postType, string $plural, string $singular ) : TaxonomyBuilder
register ( ) Triggered by the 'init' action/event.
registerFields ( ) Register the term meta.
sanitize ( array $rules = [] ) : TaxonomyBuilder Sanitize custom fields values by using passed rules.
sanitizeField ( mixed $value, string $key, string $type ) : mixed Used to run the sanitize callbacks.
save ( integer $term_id ) Save term custom field data to database.
set ( array $params = [] ) : TaxonomyBuilder Set the custom taxonomy. A user can also override the arguments by passing an array of taxonomy arguments.

Méthodes protégées

Méthode Description
getValue ( integer $term_id, Themosis\Field\Fields\IField $field, string $value = '' ) : mixed | string Return a default value for the custom fields.
setDefaultArguments ( array $posttypes, string $plural, string $singular ) : array Set the taxonomy default arguments.
setNonce ( ) Set a custom nonce.

Method Details

__construct() public méthode

Build a TaxonomyBuilder instance.
public __construct ( Application $container, DataContainer $datas, Themosis\Hook\IHook $action, ValidationBuilder $validator, Illuminate\View\Factory $view )
$container Themosis\Foundation\Application
$datas Themosis\Foundation\DataContainer The taxonomy properties.
$action Themosis\Hook\IHook
$validator Themosis\Validation\ValidationBuilder
$view Illuminate\View\Factory

addFields() public méthode

Can be called without the need to create a custom taxonomy previously (pass taxonomy name as second parameter to the method).
public addFields ( array $fields, string $taxonomy = '' ) : TaxonomyBuilder
$fields array A list of custom fields to use.
$taxonomy string The taxonomy name used to attach the fields to.
Résultat TaxonomyBuilder

bind() public méthode

Link the taxonomy to its custom post type. Allow the taxonomy to be found in 'parse_query' or 'pre_get_posts' filters.
public bind ( ) : TaxonomyBuilder
Résultat TaxonomyBuilder

displayAddFields() public méthode

Display fields on add form screen.
public displayAddFields ( )

displayEditFields() public méthode

Display fields on edit form screen.
public displayEditFields ( stdClass $term )
$term stdClass The term object

get() public méthode

Return a defined taxonomy property.
public get ( null $property = null ) : array
$property null
Résultat array

getValue() protected méthode

Return a default value for the custom fields.
protected getValue ( integer $term_id, Themosis\Field\Fields\IField $field, string $value = '' ) : mixed | string
$term_id integer
$field Themosis\Field\Fields\IField
$value string
Résultat mixed | string

make() public méthode

public make ( string $name, string | array $postType, string $plural, string $singular ) : TaxonomyBuilder
$name string The taxonomy slug name.
$postType string | array The taxonomy object type slug: 'post', 'page', ...
$plural string The taxonomy plural display name.
$singular string The taxonomy singular display name.
Résultat TaxonomyBuilder

register() public méthode

Register the custom taxonomy.
public register ( )

registerFields() public méthode

Register the term meta.
public registerFields ( )

sanitize() public méthode

Sanitize custom fields values by using passed rules.
public sanitize ( array $rules = [] ) : TaxonomyBuilder
$rules array Sanitize rules.
Résultat TaxonomyBuilder

sanitizeField() public méthode

Used to run the sanitize callbacks.
public sanitizeField ( mixed $value, string $key, string $type ) : mixed
$value mixed
$key string
$type string
Résultat mixed

save() public méthode

Save term custom field data to database.
public save ( integer $term_id )
$term_id integer

set() public méthode

Set the custom taxonomy. A user can also override the arguments by passing an array of taxonomy arguments.
public set ( array $params = [] ) : TaxonomyBuilder
$params array Taxonomy arguments to override defaults.
Résultat TaxonomyBuilder

setDefaultArguments() protected méthode

Set the taxonomy default arguments.
protected setDefaultArguments ( array $posttypes, string $plural, string $singular ) : array
$posttypes array The post type names to attach the taxonomy to.
$plural string The plural display name.
$singular string The singular display name.
Résultat array

setNonce() protected méthode

Set a custom nonce.
protected setNonce ( )

Property Details

$action protected_oe property

protected IHook,Themosis\Hook $action
Résultat Themosis\Hook\IHook

$container protected_oe property

protected Application,Themosis\Foundation $container
Résultat Themosis\Foundation\Application

$datas protected_oe property

Store the taxonomy data.
protected DataContainer,Themosis\Foundation $datas
Résultat Themosis\Foundation\DataContainer

$fields protected_oe property

The taxonomy custom fields.
protected array $fields
Résultat array

$prefix protected_oe property

protected string $prefix
Résultat string

$validator protected_oe property

protected ValidationBuilder,Themosis\Validation $validator
Résultat Themosis\Validation\ValidationBuilder

$view protected_oe property

protected Factory,Illuminate\View $view
Résultat Illuminate\View\Factory