PHP 클래스 eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\ContentExtension

Exposes helpers to play with public API objects.
상속: extends Twig_Extensio\Twig_Extension
파일 보기 프로젝트 열기: ezsystems/ezpublish-kernel

보호된 프로퍼티들

프로퍼티 타입 설명
$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