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.

Status
colourYellow
titlev1.2

Description

ez_field() is a Twig helper which returns a field value in the current language.

Note that other Twig helpers are available to display specific information of the field ; they all start with ez_field_.

Info
If the current language cannot be found as a translation for content, the main language will be used. This behavior is identical when forcing a language using forcedLanguage.

Prototype and Arguments

ez_field( eZ\Publish\CoreAPI\Repository\Values\Content\Content content, string fieldDefIdentifier[, string forcedLanguage)

Argument nameTypeDescription
contenteZ\Publish\CoreAPI\Repository\Values\Content\ContentContent object the field referred to with fieldDefIdentifier belongs to.
fieldDefIdentifierstringIdentifier of the field we want to get the value from.
forcedLanguagestringLocale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)

Usage

Code Block
<h2>My title's id: {{ ez_field( content, "title" ).id }}</h2>