You are here

easy_email.install in Easy Email 8

Same filename and directory in other branches
  1. 2.0.x easy_email.install

File

easy_email.install
View source
<?php

/**
 * Implements hook_install().
 */
function easy_email_install($is_syncing) {
  if (!$is_syncing) {
    $settings = Drupal::configFactory()
      ->getEditable('mailsystem.settings');
    $settings
      ->set('modules.easy_email.none', [
      'formatter' => 'swiftmailer',
      'sender' => 'swiftmailer',
    ])
      ->save();
  }
}

/**
 * Ensure Easy Email's entity revision metadata keys are correct.
 */
function easy_email_update_8201() {
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $entity_type = $entity_definition_update_manager
    ->getEntityType('easy_email');
  $metadata_keys = $entity_type
    ->get('revision_metadata_keys');
  $metadata_keys = is_array($metadata_keys) ? $metadata_keys : [];
  $metadata_keys = [
    'revision_default' => 'revision_default',
    'revision_user' => 'revision_user',
    'revision_created' => 'revision_created',
    'revision_log_message' => 'revision_log_message',
  ] + $metadata_keys;
  $entity_type
    ->set('revision_metadata_keys', $metadata_keys);
  $entity_definition_update_manager
    ->updateEntityType($entity_type);
}

Functions

Namesort descending Description
easy_email_install Implements hook_install().
easy_email_update_8201 Ensure Easy Email's entity revision metadata keys are correct.