ViewsData
class ViewsData (View source)
Class to manage and lazy load cached views data.
If a table is requested and cannot be loaded from cache, all data is then requested from cache. A table-specific cache entry will then be created for the requested table based on this cached data. Table data is only rebuilt when no cache entry for all table data can be retrieved.
Properties
| protected string | $baseCid | The base cache ID to use. |
|
| protected CacheBackendInterface | $cacheBackend | The cache backend to use. |
|
| protected array | $storage | Table data storage. |
|
| protected array | $allStorage | All table storage data loaded from cache. |
|
| protected bool | $fullyLoaded | Whether the data has been fully loaded in this request. |
|
| protected bool | $skipCache | Whether or not to skip data caching and rebuild data each time. |
|
| protected string | $langcode | The current language code. |
|
| protected ModuleHandlerInterface | $moduleHandler | Stores a module manager to invoke hooks. |
|
| protected LanguageManagerInterface | $languageManager | The language manager. |
Methods
Constructs this ViewsData object.
Gets all table data.
Gets data for a particular table.
Gets data from the cache backend.
Sets data to the cache backend.
Prepares the cache ID by appending a language code.
Gets all data invoked by hook_views_data().
Links tables with 'entity type' to respective generic entity-type tables.
Fetches a list of all base tables available.
Clears the class storage and cache.
Details
__construct(CacheBackendInterface $cache_backend, ConfigFactoryInterface $config, ModuleHandlerInterface $module_handler, LanguageManagerInterface $language_manager)
Constructs this ViewsData object.
array
getAll()
Gets all table data.
array
get(string $key)
Gets data for a particular table.
protected mixed
cacheGet(string $cid)
Gets data from the cache backend.
protected
cacheSet(string $cid, mixed $data)
Sets data to the cache backend.
protected string
prepareCid(string $cid)
Prepares the cache ID by appending a language code.
protected array
getData()
Gets all data invoked by hook_views_data().
This is requested from the cache before being rebuilt.
protected
processEntityTypes(array $data)
Links tables with 'entity type' to respective generic entity-type tables.
array
fetchBaseTables()
Fetches a list of all base tables available.
clear()
Clears the class storage and cache.