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.
Comment: Update page to reflect implementation better

...

ez_trans_prop( ValueObject object, string property[, string forcedLanguage)

Argument nameTypeDescription
objecteZ\Publish\Core\Repository\Values\ValueObjectValueObject object property belongs to.
propertystringProperty to get translated value from, logic is using one of the following (in this order):
  • property  object method "get{property}s" 
    method
  • object property  "get{property}s" 
forcedLanguagestringLanguage Optional language we want to force (e.g. "eng-US"), otherwise takes prioritized languages from SiteAccess settings.

...

Main language is attempted to be applied in the following way for Value objects that support this:

  • propertyWhen attribute is retrieved via object property: Use mainLanguageCode property if it exists as fallback language, but not only if either alwaysAvailable property does not exists and or is true.
  • When attribute is retrieved via object method: Provide $language = null as the only argument to the method, depends on logic of ValueObject if this gives a fallback value or not

...

Example below shows how this function can be used to get the Content name with exact same result as using ez_content_name(content)

Code Block
<span>{{ ez_trans_prop( versionInfo, "name" ) }}</span>

Example for ContentType->names:

Code Block
{{ ez_trans_prop( contentType, "name" ) }}