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


PHP ContentService::loadContentByContentInfo方法代码示例

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


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

示例1: getTranslatedContentNameByContentInfo

 /**
  * Returns content name, translated, from a ContentInfo object.
  * By default this method uses prioritized languages, unless $forcedLanguage is provided.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  * @param string $forcedLanguage Locale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
  *
  * @todo Remove ContentService usage when translated names are available in ContentInfo (see https://jira.ez.no/browse/EZP-21755)
  *
  * @return string
  */
 public function getTranslatedContentNameByContentInfo(ContentInfo $contentInfo, $forcedLanguage = null)
 {
     if (isset($forcedLanguage) && $forcedLanguage === $contentInfo->mainLanguageCode) {
         return $contentInfo->name;
     }
     return $this->getTranslatedContentName($this->contentService->loadContentByContentInfo($contentInfo), $forcedLanguage);
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:18,代码来源:TranslationHelper.php

示例2: displayGalleryAction

 /**
  * Displays the gallery.
  *
  * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function displayGalleryAction(ContentView $view, Request $request)
 {
     $languages = $this->configResolver->getParameter('languages');
     $location = $view->getLocation();
     $query = new Query();
     $query->query = $this->childrenCriteria->generateChildCriterion($location, $languages);
     $pager = new Pagerfanta(new ContentSearchAdapter($query, $this->searchService));
     $pager->setMaxPerPage($this->galleryImagesLimit);
     $pager->setCurrentPage($request->get('page', 1));
     $view->addParameters(['location' => $location, 'content' => $this->contentService->loadContentByContentInfo($view->getLocation()->getContentInfo()), 'images' => $pager]);
     return $view;
 }
开发者ID:clash82,项目名称:ezplatform-demo,代码行数:20,代码来源:GalleryController.php

示例3: thereIsAUserContent

 /**
  * @Given /^there is a User Content$/
  */
 public function thereIsAUserContent()
 {
     $login = 'user_content_' . microtime(true);
     $email = $login . '@example.com';
     $struct = $this->userService->newUserCreateStruct($login, $email, 'publish', 'eng-GB');
     $struct->setField('first_name', 'John');
     $struct->setField('last_name', 'Doe');
     $parentGroup = $this->userService->loadUserGroup(11);
     $user = $this->userService->createUser($struct, [$parentGroup]);
     $this->currentContent = $this->contentService->loadContentByContentInfo($user->contentInfo);
 }
开发者ID:Pixy,项目名称:ezpublish-kernel,代码行数:14,代码来源:UserContentContext.php

示例4: getHandler

 /**
  * @param \eZ\Publish\API\Repository\Values\Content\Location $location
  * @return \Heliopsis\eZFormsBundle\FormHandler\FormHandlerInterface
  */
 private function getHandler(Location $location)
 {
     $handler = $this->formFacade->getHandler($location);
     if ($handler instanceof LocationAwareHandlerInterface) {
         $handler->setLocation($location);
     }
     if ($handler instanceof ContentAwareHandlerInterface) {
         $handler->setContent($this->contentService->loadContentByContentInfo($location->contentInfo));
     }
     return $handler;
 }
开发者ID:heliopsis,项目名称:ezforms-bundle,代码行数:15,代码来源:FormController.php

示例5: showBlogPostAction

 /**
  * Displays blog post content with random selected blog posts.
  *
  * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view
  *
  * @return \eZ\Publish\Core\MVC\Symfony\View\ContentView
  */
 public function showBlogPostAction(ContentView $view)
 {
     $languages = $this->configResolver->getParameter('languages');
     $location = $this->locationService->loadLocation($view->getLocation()->parentLocationId);
     $query = new Query();
     $query->query = $this->childrenCriteria->generateChildCriterion($location, $languages);
     $query->performCount = false;
     $query->sortClauses = [new SortClause\DatePublished(Query::SORT_DESC)];
     $results = $this->searchService->findContent($query);
     $randomPosts = [];
     foreach ($results->searchHits as $item) {
         $randomPosts[] = $item->valueObject;
     }
     shuffle($randomPosts);
     $view->addParameters(['location' => $location, 'content' => $this->contentService->loadContentByContentInfo($view->getLocation()->getContentInfo()), 'randomPosts' => array_slice($randomPosts, 0, $this->randomPostsLimit, true)]);
     return $view;
 }
开发者ID:clash82,项目名称:ezplatform-demo,代码行数:24,代码来源:BlogController.php

示例6: loadContentByContentInfo

 /**
  * Loads content in a version for the given content info object.
  *
  * If no version number is given, the method returns the current version
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if version with the given number does not exist
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  * @param array $languages A language filter for fields. If not given all languages are returned
  * @param int $versionNo the version number. If not given the current version is returned.
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  */
 public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null)
 {
     return $this->service->loadContentByContentInfo($contentInfo, $languages, $versionNo);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:18,代码来源:ContentService.php

示例7: getFooter

 /**
  * Returns footer content object.
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  */
 public function getFooter()
 {
     $location = $this->locationService->loadLocation($this->locationSettings['footer']);
     return $this->contentService->loadContentByContentInfo($location->getContentInfo());
 }
开发者ID:obenyoussef,项目名称:metalfrance,代码行数:10,代码来源:LayoutRepository.php

示例8: loadContentByContentInfo

 /**
  * Loads content in a version for the given content info object.
  *
  * If no version number is given, the method returns the current version
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if version with the given number does not exist
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  * @param array $languages A language filter for fields. If not given all languages are returned
  * @param int $versionNo the version number. If not given the current version is returned
  * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  */
 public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
 {
     return $this->service->loadContentByContentInfo($contentInfo, $languages, $versionNo, $useAlwaysAvailable);
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:19,代码来源:ContentService.php

示例9: showAction

 /**
  * Displays blog posts and gallery images on home page.
  *
  * @param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view
  *
  * @return \eZ\Publish\Core\MVC\Symfony\View\ContentView
  */
 public function showAction(ContentView $view)
 {
     $view->addParameters(['content' => $this->contentService->loadContentByContentInfo($view->getLocation()->getContentInfo()), 'blogPosts' => $this->fetchItems($this->blogLocationId, $this->blogPostLimit), 'galleryImages' => $this->fetchItems($this->galleryLocationId, $this->galleryImageLimit), 'galleryLocationId' => $this->galleryLocationId]);
     return $view;
 }
开发者ID:clash82,项目名称:ezplatform-demo,代码行数:12,代码来源:HomeController.php

示例10: getCommentsConfig

 /**
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  *
  * @note Matched config is cached in memory by underlying matcher factory.
  *
  * @return array|null
  */
 private function getCommentsConfig(ContentInfo $contentInfo)
 {
     $view = new ContentView(null, [], 'comments');
     $view->setContent($this->contentService->loadContentByContentInfo($contentInfo));
     return $this->matcherFactory->match($view);
 }
开发者ID:michalpipa,项目名称:CommentsBundle,代码行数:13,代码来源:CommentsRenderer.php


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