当前位置: 首页>>代码示例>>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;未经允许,请勿转载。