You are here

function forward_install in Forward 8

Same name and namespace in other branches
  1. 8.3 forward.install \forward_install()
  2. 8.2 forward.install \forward_install()
  3. 5 forward.install \forward_install()
  4. 6 forward.install \forward_install()
  5. 7.3 forward.install \forward_install()
  6. 7 forward.install \forward_install()
  7. 7.2 forward.install \forward_install()
  8. 4.x forward.install \forward_install()
  9. 4.0.x forward.install \forward_install()

Implements hook_install().

File

./forward.install, line 14
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
  $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();

  // Add a custom view mode
  EntityViewMode::create(array(
    'id' => 'node.forward',
    'label' => 'Forward',
    'status' => 0,
    'targetEntityType' => 'node',
  ))
    ->save();
}