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


PHP ContentService::publishVersion方法代碼示例

本文整理匯總了PHP中eZ\Publish\API\Repository\ContentService::publishVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentService::publishVersion方法的具體用法?PHP ContentService::publishVersion怎麽用?PHP ContentService::publishVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在eZ\Publish\API\Repository\ContentService的用法示例。


在下文中一共展示了ContentService::publishVersion方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handleAction

 public function handleAction(Request $request)
 {
     $user = $this->userService->loadUserByCredentials($request->username, $request->password);
     $this->repository->setCurrentUser($user);
     $contentCreateStruct = $this->contentProvider->newContentCreateStructFromRequest($request);
     $locationCreateStruct = $this->contentProvider->newLocationCreateStructFromRequest($request);
     $content = $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
     $this->contentService->publishVersion($content->versionInfo);
 }
開發者ID:bdunogier,項目名稱:eziftttbundle,代碼行數:9,代碼來源:Handler.php

示例2: processPublish

 public function processPublish(FormActionEvent $event)
 {
     /** @var \EzSystems\RepositoryForms\Data\Content\ContentCreateData|\EzSystems\RepositoryForms\Data\Content\ContentUpdateData $data */
     $data = $event->getData();
     $form = $event->getForm();
     $draft = $this->saveDraft($data, $form->getConfig()->getOption('languageCode'));
     $content = $this->contentService->publishVersion($draft->versionInfo);
     // Redirect to the provided URL. Defaults to URLAlias of the published content.
     $redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->router->generate(UrlAliasRouter::URL_ALIAS_ROUTE_NAME, ['contentId' => $content->id], UrlGeneratorInterface::ABSOLUTE_URL);
     $event->setResponse(new RedirectResponse($redirectUrl));
 }
開發者ID:ezsystems,項目名稱:repository-forms,代碼行數:11,代碼來源:ContentFormProcessor.php

示例3: visit

 /**
  * @inheritdoc
  */
 public function visit(TreeNodeInterface $node, &$data)
 {
     if (!is_array($data)) {
         return null;
     }
     // create structure
     $contentStruct = $this->getContentCreateStruct($data);
     $locationStruct = $this->getLocationCreateStruct($data, self::DEFAULT_LOCATION_ID);
     // publish content object
     $draft = $this->contentService->createContent($contentStruct, array($locationStruct));
     $publishedContent = $this->contentService->publishVersion($draft->versionInfo);
     // Add location to the location list
     if (isset($publishedContent->contentInfo)) {
         $this->objectCollection->add('locations', $node->getName(), $publishedContent->contentInfo->mainLocationId);
     }
     // Add content to content list
     if (isset($publishedContent->contentInfo)) {
         $this->objectCollection->add('content_items', $node->getName(), $publishedContent->id);
     }
     return $publishedContent;
 }
開發者ID:silversolutions,項目名稱:content-loader-bundle,代碼行數:24,代碼來源:Content.php

示例4: publishVersion

 /**
  * Publishes a content version
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version
  * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft
  *
  * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  */
 public function publishVersion( VersionInfo $versionInfo )
 {
     $returnValue = $this->service->publishVersion( $versionInfo );
     $this->signalDispatcher->emit(
         new PublishVersionSignal(
             array(
                 'contentId' => $versionInfo->getContentInfo()->id,
                 'versionNo' => $versionInfo->versionNo,
             )
         )
     );
     return $returnValue;
 }
開發者ID:ataxel,項目名稱:tp,代碼行數:23,代碼來源:ContentService.php

示例5: publishDraft

 /**
  * Publishes a content draft.
  *
  * @param eZ\Publish\API\Repository\Values\Content\Content $content
  */
 public function publishDraft(Content $content)
 {
     $this->contentService->publishVersion($content->versionInfo->id);
 }
開發者ID:emodric,項目名稱:ezpublish-kernel,代碼行數:9,代碼來源:BasicContentContext.php


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