/** * Initialize the form * * @return void * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function init() { $pageList = $this->pageRepo->getAllPageIdsAndNamesBySiteThenType($this->currentSite->getSiteId(), 't'); $pageList['blank'] = 'Blank Page (Experts Only)'; $filter = new InputFilter(); $this->add(['name' => 'url', 'options' => ['label' => 'Page Url'], 'type' => 'text']); $filter->add(['name' => 'url', 'required' => true, 'filters' => [['name' => 'StripTags'], ['name' => 'StringTrim', 'options' => ['charlist' => '-_']]], 'validators' => [$this->pageValidator]]); $this->add(['name' => 'title', 'options' => ['label' => 'Page Title'], 'type' => 'text']); $filter->add(['name' => 'title', 'required' => true, 'filters' => [['name' => 'StripTags'], ['name' => 'StringTrim']], 'validators' => [['name' => '\\Zend\\I18n\\Validator\\Alnum', 'options' => ['allowWhiteSpace' => true]]]]); $this->add(['name' => 'page-template', 'options' => ['label' => 'Page Template', 'value_options' => $pageList], 'type' => 'Zend\\Form\\Element\\Select']); $filter->add(['name' => 'page-template', 'required' => true, 'filters' => [['name' => 'StripTags'], ['name' => 'StringTrim']], 'validators' => [$this->templateValidator]]); $this->add(['name' => 'main-layout', 'options' => ['label' => 'Main Layout', 'layouts' => $this->layoutManager->getSiteThemeLayoutsConfig($this->currentSite->getTheme())], 'type' => 'mainLayout']); $filter->add(['name' => 'main-layout', 'filters' => [['name' => 'StripTags'], ['name' => 'StringTrim']], 'validators' => [$this->layoutValidator]]); $this->setInputFilter($filter); }
/** * Test Get and Set the site Theme * * @return void * * @covers \Rcm\Entity\Site */ public function testGetAndSetTheme() { $theme = 'my-theme'; $this->site->setTheme($theme); $actual = $this->site->getTheme(); $this->assertEquals($theme, $actual); }
/** * Check to see if a layout is valid and available for a theme * * @param Site $site Site to lookup * @param string $layoutKey Layout name to search * * @return boolean * @throws InvalidArgumentException */ public function isLayoutValid(Site $site, $layoutKey) { $themesConfig = $this->getSiteThemeLayoutsConfig($site->getTheme()); if (!empty($themesConfig[$layoutKey])) { return true; } return false; }