Tagging

The tagging lets you add a tagging field.

Tagging

Parameters

Here are the parameters in adding tagging.

id
string | required

a unique slug-like string to use as an id and also as index in saving data in database.

label
string | optional

the label of the field.

description
string | optional

the description of the field and display under the label.

section
string | requiredl

the section where the field will be displayed.

default
array | optional

the default value of the field.

priority
integer | optional

determines the order of fields in section.

placeholder
string | optional

display placeholder in the field.

maxitem
int | optional

the limit number of tags.

Example


Yano::field( 'tagging', [
   'id'            => 'taggingdb1',
   'label'         => 'Enter your favorite fruits',
   'description'   => 'description.',
   'section'       => 'section_id',
   'priority'      => 1,
   'maxitem'       => 5,
] );

Example with default value! note: default value must exist in choices.


Yano::field( 'tagging', [
   'id'            => 'taggingdb1',
   'label'         => 'Enter your favorite fruits',
   'description'   => 'description.',
   'section'       => 'section_id',
   'default'       => [ 'apple', 'grapes' ],
   'priority'      => 1,
   'maxitem'       => 5
] );

Usage

The yano_get_special_values() function is recommended to retrieve data.


// Returns a array
$tags = yano_get_special_values('taggingdb1');