ViewsData::getData

protected 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.

File

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

Class

ViewsData
Class to manage and lazy load cached views data.

Namespace

Drupal\views

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;
  }
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.