ViewsData::processEntityTypes

protected ViewsData::processEntityTypes(array &$data)

Links tables with 'entity type' to respective generic entity-type tables.

Parameters

array $data: The array of data to alter entity data for, passed by reference.

File

core/modules/views/src/ViewsData.php, line 271

Class

ViewsData
Class to manage and lazy load cached views data.

Namespace

Drupal\views

Code

protected function processEntityTypes(array &$data) {
  foreach ($data as $table_name => $table_info) {
    // Add in a join from the entity-table if an entity-type is given.
    if (!empty($table_info['table']['entity type'])) {
      $entity_table = 'views_entity_' . $table_info['table']['entity type'];

      $data[$entity_table]['table']['join'][$table_name] = array(
        'left_table' => $table_name,
      );
      $data[$entity_table]['table']['entity type'] = $table_info['table']['entity type'];
      // Copy over the default table group if we have none yet.
      if (!empty($table_info['table']['group']) && empty($data[$entity_table]['table']['group'])) {
        $data[$entity_table]['table']['group'] = $table_info['table']['group'];
      }
    }
  }
}
doc_Drupal
2016-10-29 09:55:00
Comments
Leave a Comment

Please login to continue.