You are here

public function SchemeForm::submitForm in Taxonomy Access Control Lite 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/SchemeForm.php, line 134

Class

SchemeForm
Builds the scheme configuration form.

Namespace

Drupal\tac_lite\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state, $scheme = NULL) {
  $scheme = $this->scheme;
  $values = $form_state
    ->getValues();
  $this
    ->config('tac_lite.settings')
    ->set('menu_rebuild_needed', TRUE)
    ->set('tac_lite_config_scheme_' . $scheme, $values['tac_lite_config_scheme_' . $scheme])
    ->set('tac_lite_grants_scheme_' . $scheme, $values['tac_lite_grants_scheme_' . $scheme])
    ->save();
  if ($values['tac_lite_rebuild']) {
    node_access_rebuild(TRUE);
  }
  else {
    $this
      ->messenger()
      ->addWarning($this
      ->t('Do not forget to <a href=:url>rebuild node access permissions</a> after you have configured taxonomy-based access.', [
      ':url' => Url::fromRoute('node.configure_rebuild_confirm')
        ->toString(),
    ]));
  }
  parent::submitForm($form, $form_state);
}