_dataObj) { $this->_dataObj = new \App\Blog\Admin\Obj(); } return $this->_dataObj; } protected function _initElements() { $this->addElement('date', 'date', array('label' => 'Post Date', 'required' => true, 'value' => date('Y-m-d'))); $categories = (array) $this->_getDataObj()->getPostCategory4Select(array('id', 'title'), null, 'sorter'); $this->addElement( 'select', 'categoryId', array( 'label' => 'Category', 'multiOptions' => array('' => '- Select Category -') + $categories, 'required' => true, ) ); $this->addElement('text', 'title', array('label' => 'Post Title', 'required' => true, 'maxlength' => 200)); $this->addElement( 'text', 'author', ['label' => 'Author', 'filters' => ['StringTrim'], 'required' => true]); $this->_initMetaTitleElement( [ 'description' => 'This information will show in the browser tab and in search results. ' . 'If you leave this field empty - the Page Title will be the same as Post Title.', 'label' => 'Meta Title', ] ); $this->addElement( 'pageAlias', 'alias', array( 'label' => 'Post Alias', 'required' => true, 'maxlength' => 200, 'sourceField' => 'title', 'aliasValidatorOptions' => array( 'table' => new \Qs_Db_Table('Post'), 'column' => 'alias', 'currentId' => $this->_getData('id') ) ) ); $image = $this->_getDataObj()->getConfig('image'); $resize = $image->width . 'x' . $image->height . $image->resizeMethodAlias; $this->addElement('extendedImage', 'image', array('label' => 'Image', 'resize' => $resize)); $this->_initMetaKeywordsElement(); $this->_initMetaDescriptionElement(); $this->addElement('textarea', 'excerpt', array('label' => 'Introduction')); $this->addElement( 'htmlEditor', 'content', array( 'label' => 'Content', 'required' => true, 'hasMsWordNote' => true ) ); $this->addElement('checkbox', 'allowComment', array('label' => 'Allow Comments', 'decoration' => 'simple')); $this->addElement('checkbox', 'enabled', array('label' => 'Show on user end', 'decoration' => 'simple')); return $this; } public function render(\Zend_View_Interface $view = null) { /** @var $doc \Qs_Doc */ $doc = \Zend_Registry::get('doc'); $doc->addScript('js/app/admin-blog.js'); $params = array( 'alias' => $this->getElement('alias')->getId(), 'source' => $this->getElement('title')->getId() ); $doc->addInitFunction('App_Alias.init', array($params)); return parent::render($view); } }