From 0e42519709c70d68466534d7647dc2c224a6b1b8 Mon Sep 17 00:00:00 2001 From: Michael Stenta Date: Thu, 11 Aug 2022 12:26:45 -0400 Subject: [PATCH] Initial commit of core farm_notification module. This simply provides a Notifications tab in the farmOS Settings menu hierarchy, which other modules can add sub-tabs to. In the future, we can consider putting general notification logic here as well. See: https://github.com/farmOS/farmOS/pull/555#issuecomment-1213047719 --- .../notification/farm_notification.info.yml | 5 +++ .../farm_notification.links.task.yml | 12 ++++++ ..._notification.managed_role_permissions.yml | 3 ++ .../farm_notification.permissions.yml | 2 + .../farm_notification.routing.yml | 7 ++++ .../src/Form/NotificationSettingsForm.php | 41 +++++++++++++++++++ 6 files changed, 70 insertions(+) create mode 100644 modules/core/notification/farm_notification.info.yml create mode 100644 modules/core/notification/farm_notification.links.task.yml create mode 100644 modules/core/notification/farm_notification.managed_role_permissions.yml create mode 100644 modules/core/notification/farm_notification.permissions.yml create mode 100644 modules/core/notification/farm_notification.routing.yml create mode 100644 modules/core/notification/src/Form/NotificationSettingsForm.php diff --git a/modules/core/notification/farm_notification.info.yml b/modules/core/notification/farm_notification.info.yml new file mode 100644 index 000000000..06f687045 --- /dev/null +++ b/modules/core/notification/farm_notification.info.yml @@ -0,0 +1,5 @@ +name: farmOS Notification +description: Provides farmOS notification features. +type: module +package: farmOS +core_version_requirement: ^9 diff --git a/modules/core/notification/farm_notification.links.task.yml b/modules/core/notification/farm_notification.links.task.yml new file mode 100644 index 000000000..1e4c86d20 --- /dev/null +++ b/modules/core/notification/farm_notification.links.task.yml @@ -0,0 +1,12 @@ +farm_notification.settings: + base_route: farm_settings.settings_page + route_name: farm_notification.settings + title: 'Notifications' + weight: 5 + +# Provide a default sub tab. +farm_notification.settings_sub: + title: 'Notifications' + route_name: farm_notification.settings + parent_id: farm_notification.settings + weight: -5 diff --git a/modules/core/notification/farm_notification.managed_role_permissions.yml b/modules/core/notification/farm_notification.managed_role_permissions.yml new file mode 100644 index 000000000..3d1003cfb --- /dev/null +++ b/modules/core/notification/farm_notification.managed_role_permissions.yml @@ -0,0 +1,3 @@ +farm_notification: + config_permissions: + - administer farm notification diff --git a/modules/core/notification/farm_notification.permissions.yml b/modules/core/notification/farm_notification.permissions.yml new file mode 100644 index 000000000..8ce3d2aef --- /dev/null +++ b/modules/core/notification/farm_notification.permissions.yml @@ -0,0 +1,2 @@ +administer farm notification: + title: 'Administer farmOS notifications' diff --git a/modules/core/notification/farm_notification.routing.yml b/modules/core/notification/farm_notification.routing.yml new file mode 100644 index 000000000..69647b8cf --- /dev/null +++ b/modules/core/notification/farm_notification.routing.yml @@ -0,0 +1,7 @@ +farm_notification.settings: + path: '/farm/settings/notification' + defaults: + _form: '\Drupal\farm_notification\Form\NotificationSettingsForm' + _title: 'Notification settings' + requirements: + _permission: 'administer farm notification' diff --git a/modules/core/notification/src/Form/NotificationSettingsForm.php b/modules/core/notification/src/Form/NotificationSettingsForm.php new file mode 100644 index 000000000..83f3ca0ba --- /dev/null +++ b/modules/core/notification/src/Form/NotificationSettingsForm.php @@ -0,0 +1,41 @@ + 'markup', + '#markup' => $this->t('Select the tab for the type of notification to configure. Notification modules can add additional tabs to this page.'), + ]; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + + } + +}