protected function getSelectionChoices()
 {
     $choices = [];
     foreach ($this->objectStateService->loadObjectStateGroups() as $group) {
         foreach ($this->objectStateService->loadObjectStates($group) as $state) {
             $choices[$state->id] = $state->getName($state->defaultLanguageCode);
         }
     }
     return $choices;
 }
Ejemplo n.º 2
0
 /**
  * Returns the object states of content.
  *
  * @param $contentId
  *
  * @return \eZ\Publish\Core\REST\Common\Values\ContentObjectStates
  */
 public function getObjectStatesForContent($contentId)
 {
     $groups = $this->objectStateService->loadObjectStateGroups();
     $contentInfo = $this->contentService->loadContentInfo($contentId);
     $contentObjectStates = array();
     foreach ($groups as $group) {
         try {
             $state = $this->objectStateService->getContentState($contentInfo, $group);
             $contentObjectStates[] = new RestObjectState($state, $group->id);
         } catch (NotFoundException $e) {
             // Do nothing
         }
     }
     return new ContentObjectStates($contentObjectStates);
 }
Ejemplo n.º 3
0
 /**
  * Loads all object state groups.
  *
  * @param int $offset
  * @param int $limit
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup[]
  */
 public function loadObjectStateGroups($offset = 0, $limit = -1)
 {
     return $this->service->loadObjectStateGroups($offset, $limit);
 }