protected function setUp() { $this->initAutoload(); $this->bbapp = $this->getBBApp(); $this->initDb($this->bbapp); $this->initAcl(); $this->bbapp->start(); // craete site $this->site = new Site(); $this->site->setLabel('sitelabel'); $this->site->setServerName('www.example.org'); // craete layout $this->layout = new Layout(); $this->layout->setSite($this->site); $this->layout->setLabel('defaultLayoutLabel'); $this->layout->setPath($this->bbapp->getBBDir() . '/Rest/Tests/Fixtures/Controller/defaultLayout.html.twig'); $this->layout->setData(json_encode(array('templateLayouts' => array('title' => 'zone_1234567')))); $this->site->addLayout($this->layout); $this->getEntityManager()->persist($this->layout); $this->getEntityManager()->persist($this->site); $this->getEntityManager()->flush(); }
/** * Return the file path to current layout, try to create it if not exists. * * @param Layout $layout * * @return string the file path * * @throws RendererException */ protected function getLayoutFile(Layout $layout) { $layoutfile = $layout->getPath(); if (null === $layoutfile && 0 < $this->manageableExt->count()) { $adapter = null; if (null !== $this->defaultAdapter && null !== ($adapter = $this->rendererAdapters->get($this->defaultAdapter))) { $extensions = $adapter->getManagedFileExtensions(); } else { $extensions = $this->manageableExt->keys(); } if (0 === count($extensions)) { throw new RendererException('Declared adapter(s) (count:' . $this->rendererAdapters->count() . ') is/are not able to manage ' . 'any file extensions at moment.'); } $layoutfile = StringUtils::toPath($layout->getLabel(), array('extension' => reset($extensions))); $layout->setPath($layoutfile); } return $layoutfile; }
/** * Return the file path to current layout, try to create it if not exists. * * @param Layout $layout * * @return string the file path * * @throws RendererException */ protected function getLayoutFile(Layout $layout) { $layoutfile = $layout->getPath(); if (null === $layoutfile && 0 < count($this->_includeExtensions)) { $ext = reset($this->_includeExtensions); $layoutfile = StringUtils::toPath($layout->getLabel(), array('extension' => $ext)); $layout->setPath($layoutfile); } return $layoutfile; }
public function createLayout($label, $uid = null) { $layout = new Layout($uid); $layout->setLabel($label); $layout->setPath('/' . $label); $layout->setDataObject($this->getDefaultLayoutZones()); return $layout; }