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
).
Prototype and Arguments
ez_is_field_empty( eZ\Publish\API\Repository\Values\Content\Content content, eZ\Publish\API\Repository\Values\Content\Field
|string fieldDefIdentifier[, string forcedLanguage] )
Argument name | Type | Description |
---|
content | eZ\Publish\API\Repository\Values\Content\Content | Content object the displayable field belongs to. |
fieldDefIdentifier | eZ\Publish\API\Repository\Values\Content\Field or string
| The field we want to check or its identifier. |
forcedLanguage | string | Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale) |
Usage
Using the Field identifier as parameter
Using the Field as parameter
Checking if field exists before use