General

  eZ Systems Website
  Editor documentation


  Developer documentation

  Back to the top

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This Field Type represents keywords.

NameInternal nameExpected input
Keywordezkeywordstring[]|string

Description

This Field Type stores one or several comma-separated keywords as a string or array of strings.

PHP API Field Type 

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.
Code Block
languagephp
titleValue object content example
linenumberstrue
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 comma-separated in a string or as an array of strings.

Code Block
languagephp
titleConstructor example
linenumberstrue
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" );