本文整理汇总了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);
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}