Skip to the content
Documentation

Keyword Field Type: comparison of v.2 vs v.3

No ratings yet

Versions Compared

Old Version 2

changes.mady.by.user Dominika Kurek

Saved on Apr 29, 2016

compared with

New Version Current

changes.mady.by.user André Rømcke

Saved on Jan 04, 2017

Key

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

This Field Type represents keywords.

Name Internal name Expected input
Keyword ezkeyword string[]|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

Type Example
string
"documentation"
string "php, Exponential, html5"
string[] array( "eZ Systems", "Enterprise", "User Experience Management" )

Value object

Properties

The Value class of this Field Type contains the following properties:

Property Type Description
$value string[] Holds an array of keywords as strings.
Code Block
language php
title Value object content example
linenumbers true
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", "Exponential" );
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
language php
title Constructor example
linenumbers true
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" );

 

Comments

Add a comment

Comments are read by a moderator before they appear.