/** * 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); }