Backend\Modules\Tags\Actions\Edit::validateForm PHP Метод

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

Validate the form
private validateForm ( )
    private function validateForm()
    {
        // is the form submitted?
        if ($this->frm->isSubmitted()) {
            // cleanup the submitted fields, ignore fields that were added by hackers
            $this->frm->cleanupFields();
            // validate fields
            $this->frm->getField('name')->isFilled(BL::err('NameIsRequired'));
            // no errors?
            if ($this->frm->isCorrect()) {
                // build tag
                $item['id'] = $this->id;
                $item['tag'] = $this->frm->getField('name')->getValue();
                $item['url'] = BackendTagsModel::getURL(CommonUri::getUrl(\SpoonFilter::htmlspecialcharsDecode($item['tag'])), $this->id);
                // update the item
                BackendTagsModel::update($item);
                // trigger event
                BackendModel::triggerEvent($this->getModule(), 'after_edit', array('item' => $item));
                // everything is saved, so redirect to the overview
                $this->redirect(BackendModel::createURLForAction('Index') . '&report=edited&var=' . rawurlencode($item['tag']) . '&highlight=row-' . $item['id']);
            }
        }
    }