>= 5.4 / 2014.09
Description
ez_trans_prop()
is a generic, low level Twig helper which correct translated value of a multi valued(translations) property.
Prototype and Arguments
ez_trans_prop( ValueObject object, string property[, string forcedLanguage] )
Argument name | Type | Description |
---|---|---|
object | eZ\Publish\Core\Repository\Values\ValueObject | ValueObject object property belongs to. |
property | string | Property to get translated value from, logic is using one of the following (in this order):
|
forcedLanguage | string | Language we want to force (e.g. "eng-US "), otherwise takes prioritized languages from SiteAccess settings. |
Main language use
Main language is attempted to be applied in the following way for Value objects that support this:
- property: Use mainLanguageCode property if it exists, but not if alwaysAvailable exists and is true
- method: Provide
$language = null
as only argument to method, depends on logic of ValueObject if this gives a fallback value or not
Usage
Example below shows how this function can be used to get the Content name with exact same result as using ez_content_name(content)