Appearance
Installation
Notifier can be installed by:
sh
composer require drupal/notifier
drush module:enable notifier
Configuration
Notifier is configured with service parameters. This is a different process to Drupal configuration.
TIP
A fully working installation of Notifier does not require any parameter overrides. Read further to customize.
The current list of service parameters can be found in notifier.services.yml
, along with extra documentation. By defining a parameter, the associated value in notifier.services.yml
is fully overridden.
Defaults
yaml
parameters:
notifier.channel_policy:
urgent: ~
high: ~
medium: ~
low: ~
notifier.field_mapping.user_email: true
notifier.field_mapping.email: []
notifier.field_mapping.sms: []
Overriding service parameters
In the site directory, usually sites/default/
, create a services.yml
file.
Add to settings.php
:
php
$settings['container_yamls'][] = __DIR__ . '/services.yml';
Add to services.yml
:
yaml
parameters:
notifier.channel_policy: #...
notifier.field_mapping.user_email: #...
notifier.field_mapping.email: #...
notifier.field_mapping.sms: #...
Environment specific configuration
Configuration may need to be different depending on environment.
For regular Drupal configuration Config Splits or Config overrides may be utilised to have differing configuration per environment. For service files though, this behavior can be replicated by conditionally including YAML files with container_yamls
:
php
if ($environmentIsLocal) {
$settings['container_yamls'][] = __DIR__ . '/sms.local.services.yml';
}
if ($environmentIsProduction) {
$settings['container_yamls'][] = __DIR__ . '/sms.production.services.yml';
}
Parameters
Channel policy parameter
Parameter: notifier.channel_policy
Configuring the Channel policy parameter is described in Routing: channel policies.
User email field mapping parameter
Parameter: notifier.field_mapping.user_email
Configuring the User email field mapping parameter is described in user email service parameter.
Email fields mapping parameter
Parameter: notifier.field_mapping.email
Configuring the Email fields mapping parameter is described in email entity fields.
SMS fields mapping parameter
Parameter: notifier.field_mapping.sms
Configuring the SMS fields mapping parameter is described in phone number entity fields.