/**
  * @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;
 }
Exemple #2
0
 protected function fillContentStreams(PageRole $page)
 {
     $csClass = $this->container->getRoleFQN('ContentStream');
     $types = array('page-content', 'sidebar-content');
     // per default haben wir immer einen content-stream pro sprache für page-content und einen für die sidebar
     foreach ($this->container->getLanguages() as $lang) {
         foreach ($types as $type) {
             $streams = $page->getContentStream()->locale($lang)->type($type)->revision($this->defaultRevision)->collection();
             if (count($streams) == 0) {
                 $cs = $csClass::create($lang, $type, $this->defaultRevision);
                 $page->addContentStream($cs);
                 $this->dc->getEntityManager()->persist($cs);
             }
         }
     }
 }