public function NotificationsWidgetLoggerSettingsForm::removeEntityNotificationsSettings in Notifications widget 8
Remove addtional configuration for entity types.
1 call to NotificationsWidgetLoggerSettingsForm::removeEntityNotificationsSettings()
- NotificationsWidgetLoggerSettingsForm::submitForm in src/
Form/ NotificationsWidgetLoggerSettingsForm.php - Form submission handler.
File
- src/
Form/ NotificationsWidgetLoggerSettingsForm.php, line 157
Class
- NotificationsWidgetLoggerSettingsForm
- Provides settings for Activity tracking module.
Namespace
Drupal\notifications_widget\FormCode
public function removeEntityNotificationsSettings($entities, $values) {
foreach ($entities as $entityType) {
if ($this->entityTypeManager
->hasDefinition($entityType)) {
$entityTypeStorage = $this->entityTypeManager
->getStorage($entityType);
$entityTypes = $entityTypeStorage
->loadMultiple();
if (!empty($entityTypes)) {
foreach ($entityTypes as $entityType => $entityTypeData) {
$enableSettings = $entityType . '_enable';
$enableCreate = $entityType . '_noti_create_message';
$enableUpdate = $entityType . '_noti_update_message';
$enableDelete = $entityType . '_noti_delete_message';
$createLink = $entityType . '_redirect_create_link';
$updateLink = $entityType . '_redirect_update_link';
$deleteLink = $entityType . '_redirect_delete_link';
$this
->config('notifications_widget.settings')
->clear($enableSettings)
->clear($enableCreate)
->clear($enableUpdate)
->clear($enableDelete)
->clear($createLink)
->clear($updateLink)
->clear($deleteLink)
->save();
}
}
}
}
}