public function QuestionsForm::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/ QuestionsForm.php, line 162
Class
- QuestionsForm
- Form for the FAQ settings page - questions tab.
Namespace
Drupal\faq\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Remove unnecessary values.
$form_state
->cleanValues();
$this
->configFactory()
->getEditable('faq.settings')
->set('display', $form_state
->getValue('faq_display'))
->set('question_listing', $form_state
->getValue('faq_question_listing'))
->set('qa_mark', $form_state
->getValue('faq_qa_mark'))
->set('question_label', $form_state
->getValue('faq_question_label'))
->set('answer_label', $form_state
->getValue('faq_answer_label'))
->set('question_length', $form_state
->getValue('faq_question_length'))
->set('question_long_form', $form_state
->getValue('faq_question_long_form'))
->set('hide_qa_accordion', $form_state
->getValue('faq_hide_qa_accordion'))
->set('show_expand_all', $form_state
->getValue('faq_show_expand_all'))
->set('use_teaser', $form_state
->getValue('faq_use_teaser'))
->set('back_to_top', $form_state
->getValue('faq_back_to_top'))
->set('disable_node_links', $form_state
->getValue('faq_disable_node_links'))
->set('default_sorting', $form_state
->getValue('faq_default_sorting'))
->save();
parent::submitForm($form, $form_state);
}