This field type represents keywords.

NameInternal nameExpected input
Keywordezkeywordstring[]|string

Table of contents:

Description


This FieldType stores single or several keywords as comma separated keywords as a string or array of string keywords.

Input expectations


TypeExample
string
"documentation"
string

"php, eZ Publish, html5"

string[]array( "eZ Systems", "Enterprise", "User Experience Management" )

Value object


Properties

The Value class of this field type contains the following properties:

PropertyTypeDescription
$valuestring[]Holds an array of keywords as strings.
use eZ\Publish\Core\FieldType\Keyword\Value;
 
// Instantiates a Value object
$keywordValue = new Value();
 
// Sets an array of keywords as a value
$keyword->value = array( "php", "css3", "html5", "eZ Publish" );

Constructor

The Keyword\Value constructor will initialize a new Value object with the value provided.

It expects a list of keywords, either as comma separated in a string or as an array of strings.

use eZ\Publish\Core\FieldType\Keyword\Value;
 
// Instantiates a Value object with an array of keywords
$keywordValue = new Value( array( "php5", "css3", "html5" ) );
 
// Instantiates a Value object with a list of keywords in a string
// This is equivalent to the example above
$keywordValue = new Value( "php5,css3,html5" );