You are here

public function ViewsBlockBase::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 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\Block

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewExecutableFactory $executable_factory, EntityStorageInterface $storage, AccountInterface $user) {
  $this->pluginId = $plugin_id;
  $delta = $this
    ->getDerivativeId();
  list($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);
}