function ViewsData::processEntityTypes

Same name and namespace in other branches
  1. 9 core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::processEntityTypes()
  2. 8.9.x core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::processEntityTypes()
  3. 10 core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::processEntityTypes()

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.

1 call to ViewsData::processEntityTypes()
ViewsData::getData in core/modules/views/src/ViewsData.php
Gets all data invoked by hook_views_data().

File

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

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] = [
                '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'];
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.