Backend\Modules\Blog\Actions\Edit::loadForm PHP Метод

loadForm() приватный Метод

Load the form
private loadForm ( )
    private function loadForm()
    {
        // create form
        $this->frm = new BackendForm('edit');
        // set hidden values
        $rbtHiddenValues[] = array('label' => BL::lbl('Hidden'), 'value' => 'Y');
        $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
        // get categories
        $categories = BackendBlogModel::getCategories();
        $categories['new_category'] = \SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
        // create elements
        $this->frm->addText('title', $this->record['title'], null, 'form-control title', 'form-control danger title');
        $this->frm->addEditor('text', $this->record['text']);
        $this->frm->addEditor('introduction', $this->record['introduction']);
        $this->frm->addRadiobutton('hidden', $rbtHiddenValues, $this->record['hidden']);
        $this->frm->addCheckbox('allow_comments', $this->record['allow_comments'] === 'Y' ? true : false);
        $this->frm->addDropdown('category_id', $categories, $this->record['category_id']);
        if (count($categories) != 2) {
            $this->frm->getField('category_id')->setDefaultElement('');
        }
        $this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), $this->record['user_id']);
        $this->frm->addText('tags', BackendTagsModel::getTags($this->URL->getModule(), $this->record['id']), null, 'form-control js-tags-input', 'form-control danger js-tags-input');
        $this->frm->addDate('publish_on_date', $this->record['publish_on']);
        $this->frm->addTime('publish_on_time', date('H:i', $this->record['publish_on']));
        if ($this->imageIsAllowed) {
            $this->frm->addImage('image');
            $this->frm->addCheckbox('delete_image');
        }
        // meta object
        $this->meta = new BackendMeta($this->frm, $this->record['meta_id'], 'title', true);
        // set callback for generating a unique URL
        $this->meta->setURLCallback('Backend\\Modules\\Blog\\Engine\\Model', 'getURL', array($this->record['id']));
    }