当前位置: 首页>>代码示例>>PHP>>正文


PHP Content::getVersionInfo方法代码示例

本文整理汇总了PHP中eZ\Publish\API\Repository\Values\Content\Content::getVersionInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::getVersionInfo方法的具体用法?PHP Content::getVersionInfo怎么用?PHP Content::getVersionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZ\Publish\API\Repository\Values\Content\Content的用法示例。


在下文中一共展示了Content::getVersionInfo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTranslatedContentName

 /**
  * Returns content name, translated.
  * By default this method uses prioritized languages, unless $forcedLanguage is provided.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param string $forcedLanguage Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
  *
  * @return string
  */
 public function getTranslatedContentName(Content $content, $forcedLanguage = null)
 {
     foreach ($this->getLanguages($forcedLanguage) as $lang) {
         $translatedName = $content->getVersionInfo()->getName($lang);
         if ($translatedName !== null) {
             return $translatedName;
         }
     }
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:18,代码来源:TranslationHelper.php

示例2: getTranslatedContentName

 /**
  * Returns content name, translated.
  * By default this method uses prioritized languages, unless $forcedLanguage is provided.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param string $forcedLanguage Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
  *
  * @return string
  */
 public function getTranslatedContentName(Content $content, $forcedLanguage = null)
 {
     if ($forcedLanguage !== null) {
         $languages = array($forcedLanguage);
     } else {
         $languages = $this->configResolver->getParameter('languages');
     }
     // Always add null to ensure we will pass it to VersionInfo::getName() if no valid translated name is found.
     // So we have at least content name in main language.
     $languages[] = null;
     foreach ($languages as $lang) {
         $translatedName = $content->getVersionInfo()->getName($lang);
         if ($translatedName !== null) {
             return $translatedName;
         }
     }
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:26,代码来源:TranslationHelper.php

示例3: buildDomainUserGroupObject

 /**
  * Builds the domain UserGroup object from provided Content object
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroup
  */
 protected function buildDomainUserGroupObject(APIContent $content)
 {
     $locationService = $this->repository->getLocationService();
     $subGroupCount = 0;
     if ($content->getVersionInfo()->getContentInfo()->mainLocationId !== null) {
         $mainLocation = $locationService->loadLocation($content->getVersionInfo()->getContentInfo()->mainLocationId);
         $parentLocation = $locationService->loadLocation($mainLocation->parentLocationId);
         $subGroups = $this->searchSubGroups($mainLocation->id, null, Location::SORT_ORDER_ASC, 0, 0);
         $subGroupCount = $subGroups->totalCount;
     }
     return new UserGroup(array('content' => $content, 'parentId' => isset($parentLocation) ? $parentLocation->contentId : null, 'subGroupCount' => $subGroupCount));
 }
开发者ID:masev,项目名称:ezpublish-kernel,代码行数:19,代码来源:UserService.php

示例4: getVersionInfo

 /**
  * Returns the VersionInfo for this version
  *
  * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo
  */
 public function getVersionInfo()
 {
     return $this->content->getVersionInfo();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:9,代码来源:UserStub.php

示例5: assertContentValues

 /**
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param array $languages
  * @param bool $draft
  */
 protected function assertContentValues(APIContent $content, array $languages = null, $draft = false)
 {
     $versionInfoValues = $this->getVersionInfoExpectedValues($draft);
     $contentInfoValues = $this->getContentInfoExpectedValues();
     $fieldValuesValues = $this->getFieldValuesExpectedValues($languages);
     $this->assertPropertiesCorrect($versionInfoValues, $content->getVersionInfo());
     $this->assertPropertiesCorrect($contentInfoValues, $content->contentInfo);
     $this->assertEquals($fieldValuesValues, $content->fields);
     // @todo assert relations
     $this->assertEquals($content->id, $content->contentInfo->id);
 }
开发者ID:Heyfara,项目名称:ezpublish-kernel,代码行数:16,代码来源:ContentBase.php

示例6: getFieldTypeIdentifier

 /**
  * Returns the field type identifier for $field
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param \eZ\Publish\API\Repository\Values\Content\Field $field
  *
  * @return string
  */
 protected function getFieldTypeIdentifier(Content $content, Field $field)
 {
     $contentInfo = $content->getVersionInfo()->getContentInfo();
     $key = $contentInfo->contentTypeId . '  ' . $field->fieldDefIdentifier;
     if (!isset($this->fieldTypeIdentifiers[$key])) {
         $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);
         $this->fieldTypeIdentifiers[$key] = $contentType->getFieldDefinition($field->fieldDefIdentifier)->fieldTypeIdentifier;
     }
     return $this->fieldTypeIdentifiers[$key];
 }
开发者ID:blankse,项目名称:ezpublish-kernel-1,代码行数:18,代码来源:ContentExtension.php

示例7: testUpdateContentMetadataNotUpdatesContentVersion

 /**
  * Test for the updateContentMetadata() method.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  *
  * @return void
  * @see \eZ\Publish\API\Repository\ContentService::updateContentMetadata()
  * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContentMetadata
  */
 public function testUpdateContentMetadataNotUpdatesContentVersion($content)
 {
     $this->assertEquals(1, $content->getVersionInfo()->versionNo);
 }
开发者ID:Jenkosama,项目名称:ezpublish-kernel,代码行数:13,代码来源:ContentServiceTest.php

示例8: getTranslatedContentName

 /**
  * Returns content name, translated.
  * By default this method uses prioritized languages, unless $forcedLanguage is provided.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param string $forcedLanguage Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
  *
  * @return string
  */
 public function getTranslatedContentName(Content $content, $forcedLanguage = null)
 {
     return $this->getTranslatedContentNameByVersionInfo($content->getVersionInfo(), $forcedLanguage);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:13,代码来源:TranslationHelper.php

示例9: renderContent

 /**
  * Renders $content by selecting the right template.
  * $content will be injected in the selected template.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param string $viewType Variation of display for your content. Default is 'full'.
  * @param array $parameters Parameters to pass to the template called to
  *        render the view. By default, it's empty. 'content' entry is
  *        reserved for the Content that is rendered.
  * @throws \RuntimeException
  *
  * @return string
  */
 public function renderContent(Content $content, $viewType = ViewManagerInterface::VIEW_TYPE_FULL, $parameters = array())
 {
     $contentInfo = $content->getVersionInfo()->getContentInfo();
     foreach ($this->getAllContentViewProviders() as $viewProvider) {
         $view = $viewProvider->getView($contentInfo, $viewType);
         if ($view instanceof ContentViewInterface) {
             $parameters['content'] = $content;
             return $this->renderContentView($view, $parameters);
         }
     }
     throw new RuntimeException("Unable to find a template for #{$contentInfo->id}");
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:25,代码来源:Manager.php

示例10: renderPreview

 /**
  * Returns preview for $content (versionNo to display is held in $content->versionInfo).
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param array $params Hash of arbitrary parameters to pass to final view
  * @param \eZ\Publish\Core\MVC\Legacy\Templating\LegacyHelper $legacyHelper
  *
  * @return string
  */
 public function renderPreview(APIContent $content, array $params, LegacyHelper $legacyHelper)
 {
     /** @var \eZ\Publish\Core\MVC\Symfony\SiteAccess $siteAccess */
     $siteAccess = $this->getCurrentRequest()->attributes->get('siteaccess');
     $moduleResult = array();
     // Filling up moduleResult
     $result = $this->getLegacyKernel()->runCallback(function () use($content, $params, $siteAccess, &$moduleResult) {
         $contentViewModule = eZModule::findModule('content');
         $moduleResult = $contentViewModule->run('versionview', array($content->contentInfo->id, $content->getVersionInfo()->versionNo, $content->getVersionInfo()->languageCodes[0]), false, array('site_access' => $siteAccess->name) + $params);
         return ezpEvent::getInstance()->filter('response/output', $moduleResult['content']);
     }, false);
     $legacyHelper->loadDataFromModuleResult($moduleResult);
     return $result;
 }
开发者ID:emodric,项目名称:LegacyBridge,代码行数:23,代码来源:Location.php

示例11: copyContentObject

 /**
  * Copies a content object.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\Content $content
  * @param string[] $overwrites
  *
  * @return Values\Content\ContentStub
  */
 private function copyContentObject(Content $content, array $overwrites = array())
 {
     $names = array('id', 'fields', 'contentTypeId', 'versionNo', 'repository');
     $values = array();
     foreach ($names as $name) {
         if (array_key_exists($name, $overwrites)) {
             $values[$name] = $overwrites[$name];
         } else {
             $values[$name] = $content->{$name};
         }
     }
     $newContent = new ContentStub($values);
     // copy relations
     $relations = $this->loadRelations($content->getVersionInfo());
     foreach ($relations as $relation) {
         $this->addRelation($newContent->getVersionInfo(), $relation->getDestinationContentInfo());
     }
     return $newContent;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:27,代码来源:ContentServiceStub.php


注:本文中的eZ\Publish\API\Repository\Values\Content\Content::getVersionInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。