本文整理汇总了PHP中eZ\Publish\API\Repository\Values\Content\Content::getFieldsByLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::getFieldsByLanguage方法的具体用法?PHP Content::getFieldsByLanguage怎么用?PHP Content::getFieldsByLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\API\Repository\Values\Content\Content
的用法示例。
在下文中一共展示了Content::getFieldsByLanguage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mapContent
/**
* Maps Repository Content to the Site Content.
*
* @param \eZ\Publish\API\Repository\Values\Content\Content $content
* @param string $languageCode
*
* @return \Netgen\EzPlatformSiteApi\Core\Site\Values\Content
*/
public function mapContent(APIContent $content, $languageCode)
{
$contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);
$fields = $content->getFieldsByLanguage($languageCode);
$fieldsData = [];
foreach ($fields as $field) {
$fieldsData[] = $this->mapFieldData($field, $contentType);
}
return new Content(['_fields_data' => $fieldsData, 'contentInfo' => $this->mapContentInfo($content->versionInfo, $languageCode, $contentType), 'innerContent' => $content]);
}
示例2: ezobjectrelation
/**
* Method for parsing ezobjectrelation field.
* For now related fields refer to images.
*
* @param \eZ\Publish\API\Repository\Values\Content\Field $field
* @param \eZ\Publish\API\Repository\Values\Content\Content $content
* @param string $language
* @param string $imageFieldIdentifier
*
* @return string
*/
public function ezobjectrelation(Field $field, Content $content, $language, $imageFieldIdentifier)
{
$fields = $content->getFieldsByLanguage($language);
foreach ($fields as $type => $field) {
if ($type == $imageFieldIdentifier) {
return $this->ezimage($field, $content);
}
}
return '';
}
示例3: getFieldsByLanguage
/**
* This method returns the fields for a given language and non translatable fields
*
* If note set the initialLanguage of the content version is used.
*
* @param string $languageCode
*
* @return \eZ\Publish\API\Repository\Values\Content\Field[] With field identifier as keys
*/
public function getFieldsByLanguage($languageCode = null)
{
return $this->content->getFieldsByLanguage($languageCode);
}
示例4: getFirstFilledImageFieldIdentifier
public function getFirstFilledImageFieldIdentifier(Content $content)
{
foreach ($content->getFieldsByLanguage() as $field) {
$fieldTypeIdentifier = $this->fieldHelper->getFieldDefinition($content->contentInfo, $field->fieldDefIdentifier)->fieldTypeIdentifier;
if ($fieldTypeIdentifier !== 'ezimage') {
continue;
}
if ($this->fieldHelper->isFieldEmpty($content, $field->fieldDefIdentifier)) {
continue;
}
return $field->fieldDefIdentifier;
}
return null;
}