_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->_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.' ] ); $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, 'required' => true)); $this->_initMetaKeywordsElement(); $this->_initMetaDescriptionElement(); $this->addElement( 'text', 'password', array( 'label' => 'Password', 'description' => 'Protect Post with the Password', 'filters' => array('StringTrim') ) ); $this->addElement('textarea', 'excerpt', array('label' => 'Introduction')); $this->addElement( 'htmlEditor', 'content', array( 'label' => 'Content', 'required' => true, 'hasMsWordNote' => true ) ); $this->addElement('checkbox', 'featured', array('label' => 'Featured', 'decoration' => 'simple')); $this->addElement('checkbox', 'allowComment', array('label' => 'Allow Comments', 'decoration' => 'simple')); $this->addElement('checkbox', 'enabled', array('label' => 'Show on user end', 'decoration' => 'simple')); return $this; } }