_dataObj) { $this->_dataObj = new \App\Blog\Admin\Obj(); } return $this->_dataObj; } protected function _initElements() { $this->addElement('date', 'date', ['label' => 'Post Date', 'required' => true, 'value' => date('Y-m-d')]); $categories = (array) $this->_getDataObj()->getPostCategory4Select(['id', 'title'], null, 'sorter'); $this->addElement( 'select', 'categoryId', [ 'label' => 'Category', 'multiOptions' => ['' => '- Select Category -'] + $categories, 'required' => true, ] ); $this->addElement('text', 'title', ['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', [ 'label' => 'Post Alias', 'required' => true, 'maxlength' => 200, 'sourceField' => 'title', 'aliasValidatorOptions' => [ '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', ['label' => 'Image', 'resize' => $resize]); $this->_initMetaKeywordsElement(); $this->_initMetaDescriptionElement(); $this->addElement( 'text', 'password', [ 'label' => 'Password', 'description' => 'Protect Post with the Password', 'filters' => ['StringTrim'], ] ); $this->addElement('textarea', 'excerpt', ['label' => 'Introduction']); $this->addElement( 'htmlEditor', 'content', [ 'label' => 'Content', 'required' => true, 'hasMsWordNote' => true, ] ); $this->addElement('checkbox', 'featured', ['label' => 'Featured', 'decoration' => 'simple']); $this->addElement('checkbox', 'allowComment', ['label' => 'Allow Comments', 'decoration' => 'simple']); $this->addElement('checkbox', 'enabled', ['label' => 'Show on user end', 'decoration' => 'simple']); return $this; } }