PHP Класс eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\ContentExtension

Exposes helpers to play with public API objects.
Наследование: extends Twig_Extensio\Twig_Extension
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$fieldHelper eZ\Publish\Core\Helper\FieldHelper
$logger Psr\Log\LoggerInterface
$repository eZ\Publish\API\Repository\Repository
$translationHelper eZ\Publish\Core\Helper\TranslationHelper

Открытые методы

Метод Описание
__construct ( eZ\Publish\API\Repository\Repository $repository, TranslationHelper $translationHelper, FieldHelper $fieldHelper, Psr\Log\LoggerInterface $logger = null )
getFirstFilledImageFieldIdentifier ( eZ\Publish\API\Repository\Values\Content\Content $content )
getFunctions ( ) : array Returns a list of functions to add to the existing list.
getName ( ) : string Returns the name of the extension.
getTranslatedContentName ( eZ\Publish\API\Repository\Values\ValueObject $content, string $forcedLanguage = null ) : string
getTranslatedField ( eZ\Publish\API\Repository\Values\Content\Content $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : eZ\Publish\API\Repository\Values\Content\Field Returns the translated field, very similar to getTranslatedFieldValue but this returns the whole field.
getTranslatedFieldDefinitionDescription ( eZ\Publish\API\Repository\Values\ValueObject $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : string | null Gets name of a FieldDefinition description by loading ContentType based on Content/ContentInfo object.
getTranslatedFieldDefinitionName ( eZ\Publish\API\Repository\Values\ValueObject $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : string | null Gets name of a FieldDefinition name by loading ContentType based on Content/ContentInfo object.
getTranslatedFieldValue ( eZ\Publish\API\Repository\Values\Content\Content $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : mixed
getTranslatedProperty ( eZ\Publish\API\Repository\Values\ValueObject $object, string $property, string $forcedLanguage = null ) : string | null Gets translated property generic helper.
isFieldEmpty ( eZ\Publish\API\Repository\Values\Content\Content $content, eZ\Publish\API\Repository\Values\Content\Field | string $fieldDefIdentifier, string $forcedLanguage = null ) : boolean Checks if a given field is considered empty.

Приватные методы

Метод Описание
getContentType ( eZ\Publish\API\Repository\Values\ValueObject $content ) : eZ\Publish\API\Repository\Values\ContentType\ContentType | null Get ContentType by Content/ContentInfo.

Описание методов

__construct() публичный Метод

public __construct ( eZ\Publish\API\Repository\Repository $repository, TranslationHelper $translationHelper, FieldHelper $fieldHelper, Psr\Log\LoggerInterface $logger = null )
$repository eZ\Publish\API\Repository\Repository
$translationHelper eZ\Publish\Core\Helper\TranslationHelper
$fieldHelper eZ\Publish\Core\Helper\FieldHelper
$logger Psr\Log\LoggerInterface

getFirstFilledImageFieldIdentifier() публичный Метод

public getFirstFilledImageFieldIdentifier ( eZ\Publish\API\Repository\Values\Content\Content $content )
$content eZ\Publish\API\Repository\Values\Content\Content

getFunctions() публичный Метод

Returns a list of functions to add to the existing list.
public getFunctions ( ) : array
Результат array

getName() публичный Метод

Returns the name of the extension.
public getName ( ) : string
Результат string The extension name

getTranslatedContentName() публичный Метод

public getTranslatedContentName ( eZ\Publish\API\Repository\Values\ValueObject $content, string $forcedLanguage = null ) : string
$content eZ\Publish\API\Repository\Values\ValueObject Must be a valid Content or ContentInfo object.
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
Результат string

getTranslatedField() публичный Метод

To be used with ez_image_alias for example, which requires the whole field.
public getTranslatedField ( eZ\Publish\API\Repository\Values\Content\Content $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : eZ\Publish\API\Repository\Values\Content\Field
$content eZ\Publish\API\Repository\Values\Content\Content
$fieldDefIdentifier string Identifier for the field we want to get.
$forcedLanguage string Locale we want the field in (e.g. "cro-HR"). Null by default (takes current locale).
Результат eZ\Publish\API\Repository\Values\Content\Field

getTranslatedFieldDefinitionDescription() публичный Метод

Gets name of a FieldDefinition description by loading ContentType based on Content/ContentInfo object.
public getTranslatedFieldDefinitionDescription ( eZ\Publish\API\Repository\Values\ValueObject $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : string | null
$content eZ\Publish\API\Repository\Values\ValueObject Must be Content or ContentInfo object
$fieldDefIdentifier string Identifier for the field we want to get the name from
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
Результат string | null

getTranslatedFieldDefinitionName() публичный Метод

Gets name of a FieldDefinition name by loading ContentType based on Content/ContentInfo object.
public getTranslatedFieldDefinitionName ( eZ\Publish\API\Repository\Values\ValueObject $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : string | null
$content eZ\Publish\API\Repository\Values\ValueObject Must be Content or ContentInfo object
$fieldDefIdentifier string Identifier for the field we want to get the name from
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
Результат string | null

getTranslatedFieldValue() публичный Метод

public getTranslatedFieldValue ( eZ\Publish\API\Repository\Values\Content\Content $content, string $fieldDefIdentifier, string $forcedLanguage = null ) : mixed
$content eZ\Publish\API\Repository\Values\Content\Content
$fieldDefIdentifier string Identifier for the field we want to get the value from.
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale).
Результат mixed A primitive type or a field type Value object depending on the field type.

getTranslatedProperty() публичный Метод

For generic use, expects property in singular form. For instance if 'name' is provided it will first look for getName( $lang ) method, then property called ->names[$lang], in either case look for correct translation. Languages will consist of either forced language or current SiteAccess languages list, in addition for property lookup helper will look for mainLanguage property and use it if either alwaysAvailable property is true or non- existing.
public getTranslatedProperty ( eZ\Publish\API\Repository\Values\ValueObject $object, string $property, string $forcedLanguage = null ) : string | null
$object eZ\Publish\API\Repository\Values\ValueObject Can be any kid of Value object which directly holds the translated data
$property string Property name, example 'name', 'description'
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
Результат string | null

isFieldEmpty() публичный Метод

This method accepts field as Objects or by identifiers.
public isFieldEmpty ( eZ\Publish\API\Repository\Values\Content\Content $content, eZ\Publish\API\Repository\Values\Content\Field | string $fieldDefIdentifier, string $forcedLanguage = null ) : boolean
$content eZ\Publish\API\Repository\Values\Content\Content
$fieldDefIdentifier eZ\Publish\API\Repository\Values\Content\Field | string Field or Field Identifier to get the value from.
$forcedLanguage string Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale).
Результат boolean

Описание свойств

$fieldHelper защищенное свойство

protected FieldHelper,eZ\Publish\Core\Helper $fieldHelper
Результат eZ\Publish\Core\Helper\FieldHelper

$logger защищенное свойство

protected LoggerInterface,Psr\Log $logger
Результат Psr\Log\LoggerInterface

$repository защищенное свойство

protected Repository,eZ\Publish\API\Repository $repository
Результат eZ\Publish\API\Repository\Repository

$translationHelper защищенное свойство

protected TranslationHelper,eZ\Publish\Core\Helper $translationHelper
Результат eZ\Publish\Core\Helper\TranslationHelper