function ViewsBlockBase::__construct
Same name in other branches
- 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()
- 11.x core/modules/views/src/Plugin/Block/ViewsBlockBase.php \Drupal\views\Plugin\Block\ViewsBlockBase::__construct()
Constructs a \Drupal\views\Plugin\Block\ViewsBlockBase object.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin ID for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\views\ViewExecutableFactory $executable_factory: The view executable factory.
\Drupal\Core\Entity\EntityStorageInterface $storage: The views storage.
\Drupal\Core\Session\AccountInterface $user: The current user.
Overrides BlockPluginTrait::__construct
File
-
core/
modules/ views/ src/ Plugin/ Block/ ViewsBlockBase.php, line 64
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) {
$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;
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.