You are here

function _drush_multiversion_get_entity_types in Multiversion 8.2

Same name and namespace in other branches
  1. 8 multiversion.drush.inc \_drush_multiversion_get_entity_types()
2 calls to _drush_multiversion_get_entity_types()
drush_multiversion_disable_entity_types in ./multiversion.drush.inc
Implements drush_hook_COMMAND().
drush_multiversion_enable_entity_types in ./multiversion.drush.inc
Implements drush_hook_COMMAND().

File

./multiversion.drush.inc, line 161

Code

function _drush_multiversion_get_entity_types($entity_type_ids) {
  $entity_types = [];
  $manager = \Drupal::entityTypeManager();
  try {
    foreach ($entity_type_ids as $id) {
      $entity_type = $manager
        ->getStorage($id)
        ->getEntityType();
      if ($entity_type instanceof ContentEntityTypeInterface) {
        $entity_types[$id] = $entity_type;
      }
    }
  } catch (Exception $e) {
    drush_log($e
      ->getMessage(), LogLevel::ERROR);
  }
  return $entity_types;
}