Backend\Modules\Blog\Actions\Settings::validateForm PHP Method

validateForm() private method

Validates the settings form
private validateForm ( )
    private function validateForm()
    {
        if ($this->frm->isSubmitted()) {
            // validation
            $this->frm->getField('rss_title')->isFilled(BL::err('FieldIsRequired'));
            if ($this->frm->isCorrect()) {
                // set our settings
                $this->get('fork.settings')->set($this->URL->getModule(), 'overview_num_items', (int) $this->frm->getField('overview_number_of_items')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'recent_articles_full_num_items', (int) $this->frm->getField('recent_articles_full_number_of_items')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'recent_articles_list_num_items', (int) $this->frm->getField('recent_articles_list_number_of_items')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'spamfilter', (bool) $this->frm->getField('spamfilter')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'allow_comments', (bool) $this->frm->getField('allow_comments')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'moderation', (bool) $this->frm->getField('moderation')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'notify_by_email_on_new_comment_to_moderate', (bool) $this->frm->getField('notify_by_email_on_new_comment_to_moderate')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'notify_by_email_on_new_comment', (bool) $this->frm->getField('notify_by_email_on_new_comment')->getValue());
                // @TODO remove this when the api is kicked out
                $this->get('fork.settings')->set($this->URL->getModule(), 'ping_services', (bool) $this->frm->getField('ping_services')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'rss_title_' . BL::getWorkingLanguage(), $this->frm->getField('rss_title')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'rss_description_' . BL::getWorkingLanguage(), $this->frm->getField('rss_description')->getValue());
                $this->get('fork.settings')->set($this->URL->getModule(), 'rss_meta_' . BL::getWorkingLanguage(), $this->frm->getField('rss_meta')->getValue());
                if ($this->isGod) {
                    $this->get('fork.settings')->set($this->URL->getModule(), 'show_image_form', (bool) $this->frm->getField('show_image_form')->getChecked());
                }
                if ($this->get('fork.settings')->get('Core', 'akismet_key') === null) {
                    $this->get('fork.settings')->set($this->URL->getModule(), 'spamfilter', false);
                }
                // trigger event
                BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
                // redirect to the settings page
                $this->redirect(BackendModel::createURLForAction('Settings') . '&report=saved');
            }
        }
    }