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
This commit is contained in:
parent
fc77c86abe
commit
0e42519709
|
@ -0,0 +1,5 @@
|
||||||
|
name: farmOS Notification
|
||||||
|
description: Provides farmOS notification features.
|
||||||
|
type: module
|
||||||
|
package: farmOS
|
||||||
|
core_version_requirement: ^9
|
|
@ -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
|
|
@ -0,0 +1,3 @@
|
||||||
|
farm_notification:
|
||||||
|
config_permissions:
|
||||||
|
- administer farm notification
|
|
@ -0,0 +1,2 @@
|
||||||
|
administer farm notification:
|
||||||
|
title: 'Administer farmOS notifications'
|
|
@ -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'
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\farm_notification\Form;
|
||||||
|
|
||||||
|
use Drupal\Core\Form\FormBase;
|
||||||
|
use Drupal\Core\Form\FormStateInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a farm_notification settings form.
|
||||||
|
*/
|
||||||
|
class NotificationSettingsForm extends Formbase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getFormId() {
|
||||||
|
return 'farm_noication_settings';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function buildForm(array $form, FormStateinterface $form_state) {
|
||||||
|
|
||||||
|
// Add a placeholder message.
|
||||||
|
$form['placeholder'] = [
|
||||||
|
'#type' => '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) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue