You are here

public function PagesRestrictionSettingsForm::submitForm in Pages Restriction Access 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/PagesRestrictionSettingsForm.php, line 115

Class

PagesRestrictionSettingsForm
Form for configure Pages.

Namespace

Drupal\pages_restriction\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('pages_restriction.settings');
  $pages_restriction = array_values(array_filter(explode(PHP_EOL, str_replace("\r", '', $form_state
    ->getValue('pages_restriction')))));
  $pages_restriction = implode(PHP_EOL, $pages_restriction);
  $config
    ->set('pages_restriction', $pages_restriction);
  $config
    ->set('bypass_role', $form_state
    ->getValue('bypass_role'));
  $config
    ->set('keep_parameters', $form_state
    ->getValue('keep_parameters'));
  $config
    ->save();
  parent::submitForm($form, $form_state);
}