You are here

protected function ViewsData::getData in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::getData()

Gets all data invoked by hook_views_data().

This is requested from the cache before being rebuilt.

Return value

array An array of all data.

1 call to ViewsData::getData()
ViewsData::get in core/modules/views/src/ViewsData.php
Gets data for a particular table, or all tables.

File

core/modules/views/src/ViewsData.php, line 227
Contains \Drupal\views\ViewsData.

Class

ViewsData
Class to manage and lazy load cached views data.

Namespace

Drupal\views

Code

protected function getData() {
  $this->fullyLoaded = TRUE;
  if ($data = $this
    ->cacheGet($this->baseCid)) {
    return $data->data;
  }
  else {
    $modules = $this->moduleHandler
      ->getImplementations('views_data');
    $data = [];
    foreach ($modules as $module) {
      $views_data = $this->moduleHandler
        ->invoke($module, 'views_data');

      // Set the provider key for each base table.
      foreach ($views_data as &$table) {
        if (isset($table['table']) && !isset($table['table']['provider'])) {
          $table['table']['provider'] = $module;
        }
      }
      $data = NestedArray::mergeDeep($data, $views_data);
    }
    $this->moduleHandler
      ->alter('views_data', $data);
    $this
      ->processEntityTypes($data);

    // Keep a record with all data.
    $this
      ->cacheSet($this->baseCid, $data);
    return $data;
  }
}