當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Content::getFieldsByLanguage方法代碼示例

本文整理匯總了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]);
 }
開發者ID:netgen,項目名稱:ezplatform-site-api,代碼行數:18,代碼來源:DomainObjectMapper.php

示例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 '';
 }
開發者ID:sdaoudi,項目名稱:EzSystemsRecommendationBundle,代碼行數:21,代碼來源:TypeValue.php

示例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);
 }
開發者ID:brookinsconsulting,項目名稱:ezecosystem,代碼行數:13,代碼來源:UserStub.php

示例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;
 }
開發者ID:emodric,項目名稱:ezpublish-kernel,代碼行數:14,代碼來源:ContentExtension.php


注:本文中的eZ\Publish\API\Repository\Values\Content\Content::getFieldsByLanguage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。