1.20.x date.views.inc date_views_base_tables()

Helper function to map entity types to the Views base table they use, to make it easier to infer the entity type from a base table.

Views has a new handler called views_handler_field_entity() that loads entities.

And you can use something like the following to get the entity type from a view, but not all our base tables contain the entity information we need, (i.e. revisions).

So it won't work here and we resort to creating information from entity_get_info().

// A method to get the entity type for a base table. $table_data = views_fetch_data($base_table); if (!isset($table_data['table']['base']['entity type'])) { return FALSE; } $entity_type = $table_data['table']['base']['entity type'];

File

modules/date/views/date.views.inc, line 201
Defines date-related Views data and plugins:

Code

function date_views_base_tables() {
  $base_tables = &backdrop_static(__FILE__, array());

  if (empty($base_tables)) {

    // First we get the base tables we can learn about from entity_info.
    $entity_info = entity_get_info();
    foreach ($entity_info as $entity_type => $info) {
      if (!empty($info['base table'])) {
        $base_tables[$info['base table']] = $entity_type;
      }
      if (!empty($info['revision table'])) {
        $base_tables[$info['revision table']] = $entity_type;
      }
    }

    // Then we let other modules tell us about other entity tables
    // that hold date fields.
    $base_tables += module_invoke_all('date_views_extra_tables');
  }

  return $base_tables;
}