public function EntityUsageSettingsForm::submitForm in Entity Usage 8.4
Same name and namespace in other branches
- 8 src/Form/EntityUsageSettingsForm.php \Drupal\entity_usage\Form\EntityUsageSettingsForm::submitForm()
- 8.2 src/Form/EntityUsageSettingsForm.php \Drupal\entity_usage\Form\EntityUsageSettingsForm::submitForm()
- 8.3 src/Form/EntityUsageSettingsForm.php \Drupal\entity_usage\Form\EntityUsageSettingsForm::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
- src/
Form/ EntityUsageSettingsForm.php, line 207
Class
- EntityUsageSettingsForm
- Form to configure entity_usage settings.
Namespace
Drupal\entity_usage\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state
->cleanValues();
$config = $this
->config('entity_usage.settings');
$local_tasks_updated = array_filter($config
->get('local_task_enabled_entity_types')) !== array_filter($form_state
->getValue('local_task_enabled_entity_types')['entity_types']);
$site_domains = preg_replace('/[\\s, ]/', ',', $form_state
->getValue('site_domains'));
$site_domains = array_values(array_filter(explode(',', $site_domains)));
$config
->set('local_task_enabled_entity_types', array_values(array_filter($form_state
->getValue('local_task_enabled_entity_types')['entity_types'])))
->set('track_enabled_target_entity_types', array_values(array_filter($form_state
->getValue('track_enabled_target_entity_types')['entity_types'])))
->set('edit_warning_message_entity_types', array_values(array_filter($form_state
->getValue('edit_warning_message_entity_types')['entity_types'])))
->set('delete_warning_message_entity_types', array_values(array_filter($form_state
->getValue('delete_warning_message_entity_types')['entity_types'])))
->set('site_domains', $site_domains)
->set('usage_controller_items_per_page', $form_state
->getValue('usage_controller_items_per_page'))
->save();
if ($local_tasks_updated) {
$this->routerBuilder
->rebuild();
$this->cacheRender
->invalidateAll();
}
parent::submitForm($form, $form_state);
}