addElement( 'date', 'date', ['label' => 'Publication Date', 'required' => true, 'value' => date('Y-m-d')] ); $this->addElement('text', 'title', ['label' => 'News Title', 'required' => true]); $this->addSeoGroup('News'); if ($config->hasImage) { $this->addElement( 'extendedImage', 'image', [ 'label' => 'Image', 'required' => false, 'resize' => $this->getConfigArray('imageSize'), ] ); } $this->addElement('textarea', 'introduction', ['label' => 'Introduction', 'rows' => 5]); $this->addElement( 'htmlEditor', 'content', ['label' => 'Content', 'required' => true, 'hasMsWordNote' => true] ); $this->addElement( 'radio', 'linkType', ['label' => 'Type', 'multiOptions' => ['none' => 'No Link', 'url' => 'URL', 'cms' => 'Site Page', 'file' => 'File'], 'required' => true, 'separator' => '   ', 'onclick' => 'this.blur()', 'onchange' => "$('#fieldset-linkTypeGroup>dl:first').attr('class', this.value);", 'value' => 'none'] ); $this->addElement( 'text', 'url', ['label' => 'Url', 'class' => 'text', 'filters' => ['StringTrim'], 'description' => 'Example: http://www.adaptainc.com'] ); $this->getElement('url')->getDecorator('Label')->setOption('class', 'required'); $this->addElement( 'select', 'idPage', ['label' => 'Site Page', 'escapeLabel' => false, 'multiOptions' => ['' => '- Select Page -'] + App_Cms_Obj::getInstance()->getPages4Select()] ); $this->getElement('idPage')->getDecorator('Label')->setOption('class', 'required'); $this->addElement('extendedFile', 'file', ['label' => 'File']); $this->getElement('file')->getDecorator('Label')->setOption('class', 'required'); $linkType = $this->_getData('linkType', 'none'); switch ($linkType) { case 'url': $this->getElement('url')->setRequired(true); $this->getElement('url')->addValidator('Url'); break; case 'cms': $this->getElement('idPage')->setRequired(true); break; case 'file': $this->getElement('file')->setRequired(true); break; } $this->addDisplayGroup( ['linkType', 'url', 'idPage', 'file'], 'linkTypeGroup', ['legend' => 'Link'] ); $this->getDisplayGroup('linkTypeGroup')->getDecorator('HtmlTag')->setOption('class', $linkType); if (true === $config->hasFeatured) { $this->addElement('checkbox', 'featured', ['label' => 'Featured', 'decoration' => 'simple']); } $this->addElement('checkbox', 'enabled', ['label' => 'Show on user end', 'decoration' => 'simple']); return $this; } public function render(Zend_View_Interface $view = null) { /** @var \Qs_Doc $doc */ $doc = Zend_Registry::get('doc'); $doc->addStylesheet('css/modules/admin-news.css'); return parent::render($view); } }