function ViewsData::__construct

Same name in this branch
  1. 10 core/modules/content_moderation/src/ViewsData.php \Drupal\content_moderation\ViewsData::__construct()
Same name and namespace in other branches
  1. 9 core/modules/content_moderation/src/ViewsData.php \Drupal\content_moderation\ViewsData::__construct()
  2. 9 core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::__construct()
  3. 8.9.x core/modules/content_moderation/src/ViewsData.php \Drupal\content_moderation\ViewsData::__construct()
  4. 8.9.x core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::__construct()
  5. 11.x core/modules/content_moderation/src/ViewsData.php \Drupal\content_moderation\ViewsData::__construct()
  6. 11.x core/modules/views/src/ViewsData.php \Drupal\views\ViewsData::__construct()

Constructs this ViewsData object.

Parameters

\Drupal\Core\Cache\CacheBackendInterface $cache_backend: The cache backend to use.

\Drupal\Core\Extension\ModuleHandlerInterface|\Drupal\Core\Config\ConfigFactoryInterface $module_handler: The module handler class to use for invoking hooks.

\Drupal\Core\Language\LanguageManagerInterface|\Drupal\Core\Extension\ModuleHandlerInterface $language_manager: The language manager.

File

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

Class

ViewsData
Class to manage and lazy load cached views data.

Namespace

Drupal\views

Code

public function __construct(CacheBackendInterface $cache_backend, ModuleHandlerInterface|ConfigFactoryInterface $module_handler, LanguageManagerInterface|ModuleHandlerInterface $language_manager) {
    $this->cacheBackend = $cache_backend;
    if ($module_handler instanceof ConfigFactoryInterface) {
        $this->moduleHandler = $language_manager;
        $this->languageManager = func_get_arg(3);
        $this->langcode = $this->languageManager
            ->getCurrentLanguage()
            ->getId();
        @trigger_error('Calling ' . __CLASS__ . '::_construct() with the $config argument is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/2541974', E_USER_DEPRECATED);
    }
    else {
        $this->moduleHandler = $module_handler;
        $this->languageManager = $language_manager;
        $this->langcode = $this->languageManager
            ->getCurrentLanguage()
            ->getId();
    }
}

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