You are here

function easy_email_update_8201 in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x easy_email.install \easy_email_update_8201()

Ensure Easy Email's entity revision metadata keys are correct.

File

./easy_email.install, line 19

Code

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);
}