You are here

public function AnonymousPublishingClAdminSettings::submitForm in Anonymous Publishing 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

modules/anonymous_publishing_cl/src/Form/AnonymousPublishingClAdminSettings.php, line 224

Class

AnonymousPublishingClAdminSettings
This class defines the admin setting form for this module, available at : admin/config/people/anonymous_publishing_cl

Namespace

Drupal\anonymous_publishing_cl\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $settings = $this
    ->config('anonymous_publishing_cl.settings');

  // Save global configurations.
  $settings
    ->set('allowed_content_types', $form_state
    ->getValue('allowed_content_types'))
    ->set('general_options', $form_state
    ->getValue('general_options'))
    ->set('verification_persistency', $form_state
    ->getValue('verification_persistency'))
    ->set('notification_email_destination', $form_state
    ->getValue('notification_email_destination'))
    ->set('email_weight', $form_state
    ->getValue('email_weight'))
    ->set('autodelhours', $form_state
    ->getValue('autodelhours'))
    ->set('flood_limit', $form_state
    ->getValue('flood_limit'));
  if ($settings
    ->get('retain_period') == -1) {
    $settings
      ->set('user_alias', $form_state
      ->getValue('user_alias'))
      ->set('byline_guidance', $form_state
      ->getValue('byline_guidance'));
  }
  $settings
    ->save();
  Cache::invalidateTags([
    'rendered',
  ]);
  parent::submitForm($form, $form_state);
}