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


PHP LocationService::newLocationCreateStruct方法代码示例

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


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

示例1: parse

 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     if (!array_key_exists('ParentLocation', $data) || !is_array($data['ParentLocation'])) {
         throw new Exceptions\Parser("Missing or invalid 'ParentLocation' element for LocationCreate.");
     }
     if (!array_key_exists('_href', $data['ParentLocation'])) {
         throw new Exceptions\Parser("Missing '_href' attribute for ParentLocation element in LocationCreate.");
     }
     $locationHrefParts = explode('/', $this->requestParser->parseHref($data['ParentLocation']['_href'], 'locationPath'));
     $locationCreateStruct = $this->locationService->newLocationCreateStruct(array_pop($locationHrefParts));
     if (array_key_exists('priority', $data)) {
         $locationCreateStruct->priority = (int) $data['priority'];
     }
     if (array_key_exists('hidden', $data)) {
         $locationCreateStruct->hidden = $this->parserTools->parseBooleanValue($data['hidden']);
     }
     if (array_key_exists('remoteId', $data)) {
         $locationCreateStruct->remoteId = $data['remoteId'];
     }
     if (!array_key_exists('sortField', $data)) {
         throw new Exceptions\Parser("Missing 'sortField' element for LocationCreate.");
     }
     $locationCreateStruct->sortField = $this->parserTools->parseDefaultSortField($data['sortField']);
     if (!array_key_exists('sortOrder', $data)) {
         throw new Exceptions\Parser("Missing 'sortOrder' element for LocationCreate.");
     }
     $locationCreateStruct->sortOrder = $this->parserTools->parseDefaultSortOrder($data['sortOrder']);
     return $locationCreateStruct;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:37,代码来源:LocationCreate.php

示例2: setPostCategories

 public function setPostCategories($postId, Request $request)
 {
     $this->login($request->request->get('username'), $request->request->get('password'));
     // @todo Replace categories instead of adding
     $contentInfo = $this->contentService->loadContentInfo($postId);
     foreach ($request->request->get('categories') as $category) {
         $this->locationService->createLocation($contentInfo, $this->locationService->newLocationCreateStruct($category['categoryId']));
     }
     return new Response(true);
 }
开发者ID:bdunogier,项目名称:wordpressapibundle,代码行数:10,代码来源:DefaultController.php

示例3: createWithoutDraftAction

 /**
  * Displays and processes a content creation form. Showing the form does not create a draft in the repository.
  *
  * @param int $contentTypeIdentifier ContentType id to create
  * @param string $language Language code to create the content in (eng-GB, ger-DE, ...))
  * @param int $parentLocationId Location the content should be a child of
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function createWithoutDraftAction($contentTypeIdentifier, $language, $parentLocationId, Request $request)
 {
     $contentType = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier);
     $data = (new ContentCreateMapper())->mapToFormData($contentType, ['mainLanguageCode' => $language, 'parentLocation' => $this->locationService->newLocationCreateStruct($parentLocationId)]);
     $form = $this->createForm(ContentEditType::class, $data, ['languageCode' => $language]);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $this->contentActionDispatcher->dispatchFormAction($form, $data, $form->getClickedButton()->getName());
         if ($response = $this->contentActionDispatcher->getResponse()) {
             return $response;
         }
     }
     return $this->render('EzSystemsRepositoryFormsBundle:Content:content_edit.html.twig', ['form' => $form->createView(), 'languageCode' => $language, 'pagelayout' => $this->pagelayout]);
 }
开发者ID:ezsystems,项目名称:repository-forms,代码行数:24,代码来源:ContentEditController.php

示例4: getLocationCreateStruct

 /**
  * Creates and prepares location create structure.
  *
  * @param array $data
  * @param int $defaultLocationId
  * @return \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct
  */
 private function getLocationCreateStruct($data, $defaultLocationId)
 {
     $parentLocationId = $this->getContentDataParentLocationId($data, $defaultLocationId);
     $locationStruct = $this->locationService->newLocationCreateStruct($parentLocationId);
     $locationStruct->priority = isset($data['priority']) ? $data['priority'] : 0;
     return $locationStruct;
 }
开发者ID:silversolutions,项目名称:content-loader-bundle,代码行数:14,代码来源:Content.php

示例5: newLocationCreateStruct

 /**
  * Instantiates a new location create class
  *
  * @param mixed $parentLocationId the parent under which the new location should be created
  *
  * @return \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct
  */
 public function newLocationCreateStruct($parentLocationId)
 {
     return $this->service->newLocationCreateStruct($parentLocationId);
 }
开发者ID:nlescure,项目名称:ezpublish-kernel,代码行数:11,代码来源:LocationService.php


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