You are here

public function AdminSettingsForm::submitForm in Exclude Node Title 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/AdminSettingsForm.php, line 184

Class

AdminSettingsForm
Form object class for Exclude Node Title settings.

Namespace

Drupal\exclude_node_title\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = \Drupal::configFactory()
    ->getEditable('exclude_node_title.settings');
  $values = $form_state
    ->getValues();
  foreach ($values['content_type'] as $node_type => $value) {
    $modes = array_filter($values['content_type'][$node_type]['content_type_modes']);
    $modes = array_keys($modes);
    $config
      ->set('content_types.' . $node_type, $values['content_type'][$node_type]['content_type_value'])
      ->set('content_type_modes.' . $node_type, $modes);
  }
  $config
    ->set('search', $values['exclude_node_title_search'])
    ->set('type', $values['render_type'])
    ->save();
  parent::submitForm($form, $form_state);
  foreach (Cache::getBins() as $service_id => $cache_backend) {
    $cache_backend
      ->deleteAll();
  }
}