/** * @return array */ public function getContentStreamButtons(PageRole $page, EntityMeta $contentStreamEntityMeta) { $buttons = array(); foreach ($page->getContentStream()->type('page-content')->revision($this->defaultRevision)->collection() as $contentStream) { $adapter = $contentStreamEntityMeta->getAdapter($contentStream, EntityMeta::CONTEXT_GRID); $adapter->setButtonMode(\Psc\CMS\Item\Buttonable::CLICK | \Psc\CMS\Item\Buttonable::DRAG); $adapter->setTabLabel('Seiteninhalt: ' . $page->getSlug() . ' (' . mb_strtoupper($contentStream->getLocale()) . ')'); $button = $adapter->getTabButton(); if ($lc = $contentStream->getLocale()) { $button->setLabel('Seiteninhalt für ' . mb_strtoupper($lc) . ' bearbeiten'); } else { $button->setLabel('Seiteninhalt #' . $contentStream->getIdentifier() . ' bearbeiten'); } $button->setLeftIcon('pencil'); $buttons[] = $button; } $sideBarStreams = $page->getContentStream()->type('sidebar-content')->revision($this->defaultRevision)->collection(); if (count($sideBarStreams) > 0) { $buttons[] = '<br /><br />'; foreach ($sideBarStreams as $contentStream) { $adapter = $contentStreamEntityMeta->getAdapter($contentStream, EntityMeta::CONTEXT_GRID); $adapter->setButtonMode(\Psc\CMS\Item\Buttonable::CLICK | \Psc\CMS\Item\Buttonable::DRAG); $adapter->setTabLabel('Sidebar: ' . $page->getSlug() . ' (' . mb_strtoupper($contentStream->getLocale()) . ')'); $button = $adapter->getTabButton(); if ($lc = $contentStream->getLocale()) { $button->setLabel('Sidebar ' . $contentStream->getLocale() . ' bearbeiten'); } $button->setLeftIcon('pencil'); $button->setRightIcon('grip-dotted-vertical'); $buttons[] = $button; } } return $buttons; }
/** * Wandelt die assignedValues in Buttons um * * die JooseSnippets werden gesammelt, wenn sie extrahierbar sind * @return list($buttons, $snippets) */ protected function convertButtons() { $buttons = array(); $snippets = array(); if (isset($this->assignedValues)) { foreach ($this->assignedValues as $item) { if ($item instanceof \Psc\UI\ButtonInterface) { $button = $item; } elseif ($item instanceof \Psc\CMS\Entity) { $button = $this->entityMeta->getAdapter($item)->setButtonMode(Buttonable::CLICK | Buttonable::DRAG)->getDropBoxButton(); } else { throw new \InvalidArgumentException(Code::varInfo($item) . ' kann nicht in einen Button umgewandelt werden'); } if ($button instanceof \Psc\JS\JooseSnippetWidget) { $button->disableAutoLoad(); // das bevor getJooseSnippet() machen damit widgetSelector im snippet geht // aber NACH disableAutoLoad() $button->html()->addClass('assigned-item'); $snippets[] = $button->getJooseSnippet(); } else { $button->html()->addClass('assigned-item'); } $buttons[] = $button; } } return array($buttons, $snippets); }
/** * @return Psc\UI\Accordion */ public function createRightAccordion(EntityMeta $entityMeta = NULL, $optionsLabel = 'Options', array $options = array()) { $entity = $this->getEntity(); $accordion = new Accordion(array('autoHeight' => true, 'active' => 0)); if (isset($entityMeta)) { if (!$entity->isNew()) { $options[] = $deleteButton = $entityMeta->getAdapter($entity, EntityMeta::CONTEXT_DELETE)->getDeleteTabButton(); } } $accordion->addSection($optionsLabel, $options); $this->addAccordion($accordion); return $accordion; }
protected function exportItem($item) { return $this->exporter->ComboDropBoxable($this->entityMeta->getAdapter($item)); //return $this->exporter->SelectComboBoxable($this->entityMeta->getAdapter($item)); }