You are here

public function ContentReportSettingsForm::submitForm in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  2. 8.6 modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  3. 8.7 modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  4. 8.8 modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  5. 10.3.x modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  6. 10.0.x modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  7. 10.1.x modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()
  8. 10.2.x modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php \Drupal\social_content_report\Form\ContentReportSettingsForm::submitForm()

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

modules/social_features/social_content_report/src/Form/ContentReportSettingsForm.php, line 106

Class

ContentReportSettingsForm
Class EventSettingsForm.

Namespace

Drupal\social_content_report\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $term_ids = [];
  foreach ($form_state
    ->getValue('reasons_with_text') as $term_id) {
    if ($term_id) {
      $term_ids[] = $term_id;
    }
  }
  $this
    ->config('social_content_report.settings')
    ->set('unpublish_threshold', $form_state
    ->getValue('unpublish_threshold'))
    ->set('reasons_with_text', $term_ids)
    ->set('mandatory_reason', $form_state
    ->getValue('mandatory_reason'))
    ->save();
}