function ViewsBlockBase::__construct
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/Block/ViewsBlockBase.php \Drupal\views\Plugin\Block\ViewsBlockBase::__construct()
- 10 core/modules/views/src/Plugin/Block/ViewsBlockBase.php \Drupal\views\Plugin\Block\ViewsBlockBase::__construct()
- 9 core/modules/views/src/Plugin/Block/ViewsBlockBase.php \Drupal\views\Plugin\Block\ViewsBlockBase::__construct()
- 8.9.x core/modules/views/src/Plugin/Block/ViewsBlockBase.php \Drupal\views\Plugin\Block\ViewsBlockBase::__construct()
Overrides BlockPluginTrait::__construct
File
-
core/
modules/ views/ src/ Plugin/ Block/ ViewsBlockBase.php, line 55
Class
- ViewsBlockBase
- Base class for Views block plugins.
Namespace
Drupal\views\Plugin\BlockCode
public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewExecutableFactory $executable_factory, EntityStorageInterface $storage, AccountInterface $user, ?ContextualLinksHelper $contextual_links = NULL) {
$this->pluginId = $plugin_id;
$delta = $this->getDerivativeId();
[$name, $this->displayID] = explode('-', $delta, 2);
// Load the view.
$view = $storage->load($name);
$this->view = $executable_factory->get($view);
$this->displaySet = $this->view
->setDisplay($this->displayID);
$this->user = $user;
if (!$contextual_links) {
@trigger_error('Calling ' . __METHOD__ . '() without the $contextual_links argument is deprecated in drupal:11.4.0 and will be required in drupal:13.0.0. See https://www.drupal.org/node/3382344', E_USER_DEPRECATED);
$contextual_links = \Drupal::service(ContextualLinksHelper::class);
}
$this->contextualLinks = $contextual_links;
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.