You are here

function taxonomy_entity_index_entity_views_integrable in Taxonomy Entity Index 8

Same name and namespace in other branches
  1. 7 taxonomy_entity_index.module \taxonomy_entity_index_entity_views_integrable()

Get all entity types, which can be used in the views integration.

Therefore both the entity type has to be fieldable and the base table has already a views integration.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] An array of entity types.

1 call to taxonomy_entity_index_entity_views_integrable()
taxonomy_entity_index_views_data_alter in ./taxonomy_entity_index.views.inc
Implements hook_views_data_alter().

File

./taxonomy_entity_index.module, line 292
Module file for taxonomy_entity_index.

Code

function taxonomy_entity_index_entity_views_integrable() {
  $entity_types = \Drupal::entityTypeManager()
    ->getDefinitions();
  foreach ($entity_types as $entity_type_id => $entity_type) {
    if (is_null($entity_type
      ->getBaseTable()) || !$entity_type
      ->entityClassImplements('\\Drupal\\Core\\Entity\\ContentEntityInterface')) {
      unset($entity_types[$entity_type_id]);
    }
  }
  return $entity_types;
}