You are here

public function CategoriesForm::submitForm in Frequently Asked Questions 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

src/Form/CategoriesForm.php, line 149

Class

CategoriesForm
Form for the FAQ settings page - categories tab.

Namespace

Drupal\faq\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Remove unnecessary values.
  $form_state
    ->cleanValues();
  $this
    ->configFactory()
    ->getEditable('faq.settings')
    ->set('use_categories', $form_state
    ->getValue('faq_use_categories'))
    ->set('category_display', $form_state
    ->getValue('faq_category_display'))
    ->set('category_listing', $form_state
    ->getValue('faq_category_listing'))
    ->set('category_hide_qa_accordion', $form_state
    ->getValue('faq_category_hide_qa_accordion'))
    ->set('count', $form_state
    ->getValue('faq_count'))
    ->set('answer_category_name', $form_state
    ->getValue('faq_answer_category_name'))
    ->set('group_questions_top', $form_state
    ->getValue('faq_group_questions_top'))
    ->set('hide_child_terms', $form_state
    ->getValue('faq_hide_child_terms'))
    ->set('show_term_page_children', $form_state
    ->getValue('faq_show_term_page_children'))
    ->set('omit_vocabulary', $form_state
    ->getValue('faq_omit_vocabulary'))
    ->save();
  parent::submitForm($form, $form_state);
}