'none', 'show' => 'y', ); protected function _initElements() { $config = $this->getConfig()->toArray(); $descriptionTitle = "Text space is limited to " . $config['maxImageTitleLength'] . " characters. Characters above the limit won't be shown on the user end."; $this->addElement( 'text', 'title', array( 'label' => 'Title', 'required' => true, 'description' => $descriptionTitle ) ); $this->addElement( 'extendedImage', 'image', array( 'label' => 'Slide Image', 'required' => true, 'resize' => $config['image']['width'] . 'x' . $config['image']['height'] . $config['image']['resizeMethodAlias'], 'validators' => array( array('IsImage', true), array( 'ImageSize', true, array( 'minwidth' => $config['image']['width'], 'minheight' => $config['image']['height'] ) ) ) ) ); $linkType = $this->_getData('linkType'); $this->addElement( 'select', 'linkType', array( 'label' => 'Type', 'multiOptions' => array('none' => 'No Link', 'url' => 'URL', 'cms' => 'Site Page'), 'required' => true, 'value' => $linkType, 'separator' => ' ', ) ); $this->addElement( 'text', 'url', array( 'label' => 'Url', 'class' => 'text', 'validators' => array('url'), 'description' => 'Example: http://www.adaptainc.com' ) ); $this->addElement('text', 'linkText', array('label' => 'Link Text', 'class' => 'text')); $this->addElement('select', 'pageId', array('label' => 'Site Page', 'escapeLabel' => false)); $this->pageId->setMultiOptions(array('' => '- Select Page -') + App_Cms_Obj::getInstance()->getPages4Select(0)); $this->addDisplayGroup( array('linkType', 'url', 'pageId', 'linkText'), 'linkTypeGroup', array('legend' => 'Link') ); $this->getDisplayGroup('linkTypeGroup')->getDecorator('HtmlTag')->setOption('class', $linkType); $this->addElement('checkbox', 'show', array('label' => 'Show on user end', 'decoration' => 'simple')); if (in_array($linkType, array('url', 'cms'))) { if ('url' == $linkType) { $this->getElement('url')->setRequired(); } else if ('cms' == $linkType) { $this->getElement('pageId')->setRequired(); } } } public function render(Zend_View_Interface $view = null) { /** * спочатку робиться рендер щоб ініціалізувалась форма і підчепились джаваскрипти, бо з App_PwxSlide.updateQsForm() * робляться звернення до Qs_Form */ $content = parent::render($view); /** @var $doc Qs_Doc */ $doc = Zend_Registry::get('doc'); $doc->addScript('js/app/admin-pwxslide.js'); $options = array('formId' => $this->getId()); $doc->addInitFunction('initappPwxSlide', array($options)); return $content; } }