public function NotificationsWidgetLoggerSettingsForm::submitForm in Notifications widget 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/ NotificationsWidgetLoggerSettingsForm.php, line 128
Class
- NotificationsWidgetLoggerSettingsForm
- Provides settings for Activity tracking module.
Namespace
Drupal\notifications_widget\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$values = $form_state
->getValues();
$savedEntities = explode(',', $this
->config('notifications_widget.settings')
->get('additional_entity_type'));
$revisedEntities = explode(',', $values['additional_entity_type']);
// Prepare removed entity types and remove its configuration.
$deletedEntities = array_diff($savedEntities, $revisedEntities);
$this
->removeEntityNotificationsSettings($deletedEntities, $values);
$this
->config('notifications_widget.settings')
->set('excluded_entities', $values['excluded_entities'])
->set('additional_entity_type', $values['additional_entity_type'])
->save();
$this->messengerTypeManager
->addMessage($this
->t('Notification widget will work well once you saved the configuration from <a href=":user_settings_url">Notification Widget Settings</a>.', [
':user_settings_url' => Url::fromRoute('notifications_widget.notifications_widget_settings')
->toString(),
]), 'warning');
}