You are here

function multiversion_update_8103 in Multiversion 8

Enable poll and poll_choices.

File

./multiversion.install, line 457

Code

function multiversion_update_8103() {
  if (\Drupal::moduleHandler()
    ->moduleExists('poll')) {
    $manager = \Drupal::entityTypeManager();
    $entity_types = [];
    foreach ([
      'poll_choice',
      'poll',
    ] as $id) {
      $entity_type = $manager
        ->getStorage($id)
        ->getEntityType();
      if ($entity_type instanceof ContentEntityTypeInterface) {
        $entity_types[$id] = $entity_type;
      }
    }
    if (!empty($entity_types)) {
      \Drupal::service('multiversion.manager')
        ->enableEntityTypes($entity_types);
    }
  }
}