Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewsData.php

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

2 calls to ViewsData::getData()
ViewsData::get in core/modules/views/src/ViewsData.php
Gets data for a particular table.
ViewsData::getAll in core/modules/views/src/ViewsData.php
Gets all table data.

File

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

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 {
        $data = [];
        $this->moduleHandler
            ->invokeAllWith('views_data', function (callable $hook, string $module) use (&$data) {
            $views_data = $hook();
            // 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;
    }
}
RSS feed
Powered by Drupal