當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。