General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Versions Compared

Key

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

Table of Contents

Info
titleVersion compatibility

This Twig helper is available as of eZ Publish 5.2 / 2013.09

  • Using a Field as fieldDefIdentifier argument as of eZ Publish 5.3 / 2014.03

Description

ez_is_field_empty() is a Twig helper which checks if a Content item's field value is considered empty , in the current language.

It returns a boolean value (true or false).

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.

...

Argument nameTypeDescription
contenteZ\Publish\Core\Repository\Values\Content\ContentContent object the displayable field belongs to.
fieldDefIdentifiereZ\Publish\API\Repository\Values\Content\Field or string
The field we want to check or its identifier.
forcedLanguagestringLocale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)

Usage

Using the

...

Field identifier as parameter

Code Block
languagehtml/xml
{# Display "description" field if not empty #}
{% if not ez_is_field_empty( content, "description" ) %}
    <div class="description">
        {{ ez_render_field( content, "description" ) }}
    </div>
{% endif %}

...