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


PHP ContentTypeService::loadContentTypeDraft方法代码示例

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


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

示例1: processAddFieldDefinition

 public function processAddFieldDefinition(FormActionEvent $event)
 {
     // Reload the draft, to make sure we include any changes made in the current form submit
     $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($event->getData()->contentTypeDraft->id);
     $fieldTypeIdentifier = $event->getForm()->get('fieldTypeSelection')->getData();
     $maxFieldPos = 0;
     foreach ($contentTypeDraft->fieldDefinitions as $existingFieldDef) {
         if ($existingFieldDef->position > $maxFieldPos) {
             $maxFieldPos = $existingFieldDef->position;
         }
     }
     $fieldDefCreateStruct = new FieldDefinitionCreateStruct(['fieldTypeIdentifier' => $fieldTypeIdentifier, 'identifier' => sprintf('new_%s_%d', $fieldTypeIdentifier, count($contentTypeDraft->fieldDefinitions) + 1), 'names' => [$event->getOption('languageCode') => 'New FieldDefinition'], 'position' => $maxFieldPos + 1]);
     $this->contentTypeService->addFieldDefinition($contentTypeDraft, $fieldDefCreateStruct);
 }
开发者ID:crevillo,项目名称:repository-forms,代码行数:14,代码来源:ContentTypeFormProcessor.php

示例2: updateContentTypeAction

 public function updateContentTypeAction(Request $request, $contentTypeId, $languageCode = null)
 {
     $languageCode = $languageCode ?: $this->prioritizedLanguages[0];
     // First try to load the draft.
     // If it doesn't exist, create it.
     try {
         $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
     } catch (NotFoundException $e) {
         $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($this->contentTypeService->loadContentType($contentTypeId));
     }
     $contentTypeData = (new ContentTypeDraftMapper())->mapToFormData($contentTypeDraft);
     $form = $this->createForm('ezrepoforms_contenttype_update', $contentTypeData, ['languageCode' => $languageCode]);
     $actionUrl = $this->generateUrl('admin_contenttypeUpdate', ['contentTypeId' => $contentTypeId, 'languageCode' => $languageCode]);
     // Synchronize form and data.
     $form->handleRequest($request);
     $hasErrors = false;
     if ($form->isValid()) {
         $this->contentTypeActionDispatcher->dispatchFormAction($form, $contentTypeData, $form->getClickedButton() ? $form->getClickedButton()->getName() : null, ['languageCode' => $languageCode]);
         if ($response = $this->contentTypeActionDispatcher->getResponse()) {
             return $response;
         }
         return $this->redirectAfterFormPost($actionUrl);
     } elseif ($form->isSubmitted()) {
         $hasErrors = true;
     }
     return $this->render('eZPlatformUIBundle:ContentType:update_content_type.html.twig', ['form' => $form->createView(), 'action_url' => $actionUrl, 'contentTypeName' => $contentTypeDraft->getName($languageCode), 'contentTypeDraft' => $contentTypeDraft, 'modifier' => $this->userService->loadUser($contentTypeDraft->modifierId), 'languageCode' => $languageCode, 'hasErrors' => $hasErrors]);
 }
开发者ID:yed30,项目名称:PlatformUIBundle,代码行数:27,代码来源:ContentTypeController.php

示例3: getFieldDefinition

 /**
  * Returns field definition by 'typeFieldDefinitionDraft' pattern URL.
  *
  * Assumes given $data array has '__url' element set.
  * @todo depends on temporary solution to give parser access to the URL
  * @see \eZ\Publish\Core\REST\Server\Controller\ContentType::updateFieldDefinition
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
  *
  * @param array $data
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition
  */
 protected function getFieldDefinition(array $data)
 {
     $contentTypeId = $this->requestParser->parseHref($data["__url"], 'contentTypeId');
     $fieldDefinitionId = $this->requestParser->parseHref($data["__url"], 'fieldDefinitionId');
     $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
     foreach ($contentTypeDraft->getFieldDefinitions() as $fieldDefinition) {
         if ($fieldDefinition->id == $fieldDefinitionId) {
             return $fieldDefinition;
         }
     }
     throw new Exceptions\NotFoundException("Field definition not found: '{$data["__url"]}'.");
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:25,代码来源:FieldDefinitionUpdate.php

示例4: loadContentTypeDraft

 /**
  * Get a Content Type object draft by id
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the content type draft owned by the current user can not be found
  *
  * @param mixed $contentTypeId
  *
  * @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeDraft
  */
 public function loadContentTypeDraft($contentTypeId)
 {
     return $this->service->loadContentTypeDraft($contentTypeId);
 }
开发者ID:Jenkosama,项目名称:ezpublish-kernel,代码行数:13,代码来源:ContentTypeService.php

示例5: deleteContentTypeDraft

 /**
  * The given content type draft is deleted
  *
  * @param $contentTypeId
  *
  * @return \eZ\Publish\Core\REST\Server\Values\NoContent
  */
 public function deleteContentTypeDraft($contentTypeId)
 {
     $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
     $this->contentTypeService->deleteContentType($contentTypeDraft);
     return new Values\NoContent();
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:13,代码来源:ContentType.php


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