Backend\Modules\Blog\Actions\EditCategory::validateForm PHP Метод

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

Validate the form
private validateForm ( )
    private function validateForm()
    {
        if ($this->frm->isSubmitted()) {
            // cleanup the submitted fields, ignore fields that were added by hackers
            $this->frm->cleanupFields();
            // validate fields
            $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
            // validate meta
            $this->meta->validate();
            if ($this->frm->isCorrect()) {
                // build item
                $item['id'] = $this->id;
                $item['title'] = $this->frm->getField('title')->getValue();
                $item['meta_id'] = $this->meta->save(true);
                // update the item
                BackendBlogModel::updateCategory($item);
                // trigger event
                BackendModel::triggerEvent($this->getModule(), 'after_edit_category', array('item' => $item));
                // everything is saved, so redirect to the overview
                $this->redirect(BackendModel::createURLForAction('Categories') . '&report=edited-category&var=' . rawurlencode($item['title']) . '&highlight=row-' . $item['id']);
            }
        }
    }