function forward_install in Forward 4.0.x
Same name and namespace in other branches
- 8.3 forward.install \forward_install()
- 8 forward.install \forward_install()
- 8.2 forward.install \forward_install()
- 5 forward.install \forward_install()
- 6 forward.install \forward_install()
- 7.3 forward.install \forward_install()
- 7 forward.install \forward_install()
- 7.2 forward.install \forward_install()
- 4.x forward.install \forward_install()
Implements hook_install().
File
- ./
forward.install, line 11 - Install, update and uninstall functions for the forward module.
Code
function forward_install() {
// Set default values for config which require dynamic values.
\Drupal::configFactory()
->getEditable('forward.settings')
->set('forward_email_from_address', \Drupal::config('system.site')
->get('mail'))
->save();
// Add the Forward mail plugin that sends HTML email for the 'send_entity'
// key only. All other emails from Forward or any other module will use the
// standard plugin. If a different mail plug becomes the default, that
// plugin will be used instead.
$config = \Drupal::configFactory()
->getEditable('system.mail');
$interface = $config
->get('interface');
$interface['forward_send_entity'] = 'forward_mail';
\Drupal::configFactory()
->getEditable('system.mail')
->set('interface', $interface)
->save();
// If the MailSystem module is enabled, add the Forward module setting.
// This enables Forward mail to be sent as HTML format.
if (\Drupal::service('module_handler')
->moduleExists('mailsystem')) {
$config = \Drupal::configFactory()
->get('mailsystem.settings')
->get('modules');
$config['forward']['send_entity'] = [
'formatter' => 'forward_mail',
'sender' => 'forward_mail',
];
\Drupal::configFactory()
->getEditable('mailsystem.settings')
->set('modules', $config)
->save();
}
}