You are here

function taxonomy_entity_index_entity_views_integrable in Taxonomy Entity Index 7

Same name and namespace in other branches
  1. 8 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.

Parameters

$data: The views data, which can be used to check whether a base table has a views integration.

$entity_type: The entity type, e.g. node, for which the info shall be returned, or NULL to return an array with info about all types.

Return value

Information about all entity types / a single entity type.

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

File

./taxonomy_entity_index.module, line 305

Code

function taxonomy_entity_index_entity_views_integrable($data, $entity_type = NULL) {
  $entity_info = entity_get_info($entity_type);
  if (!empty($entity_type)) {
    $entity_info = array(
      $entity_type => $entity_info,
    );
  }
  foreach ($entity_info as $entity_type => $info) {
    $base_table = $info['base table'];

    // Filter out entity types which don't have a base table implementation
    // or aren't fieldable.
    if (!isset($data[$base_table]) || empty($info['fieldable'])) {
      unset($entity_info[$entity_type]);
    }
  }
  return $entity_info;
}