Example #1
0
 /**
  * Render the panels.
  *
  * @param array $ignoredPanels A list with ignored elements [Optional].
  *
  * @throws DcGeneralRuntimeException When no information of panels can be obtained from the data container.
  *
  * @return string
  */
 public function render($ignoredPanels = array())
 {
     if ($this->view->getPanel() === null) {
         throw new DcGeneralRuntimeException('No panel information stored in data container.');
     }
     $environment = $this->getEnvironment();
     $dispatcher = $environment->getEventDispatcher();
     $panels = array();
     foreach ($this->view->getPanel() as $panel) {
         $panels[] = $this->renderPanelRow($panel, $ignoredPanels);
     }
     if (count($panels)) {
         $template = new ContaoBackendViewTemplate('dcbe_general_panel');
         $themeEvent = new GetThemeEvent();
         $dispatcher->dispatch(ContaoEvents::BACKEND_GET_THEME, $themeEvent);
         $template->set('action', ampersand($environment->getInputProvider()->getRequestUrl(), true))->set('theme', $themeEvent->getTheme())->set('panel', $panels);
         return $template->parse();
     }
     return '';
 }