Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewsBlockBase.php

function 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();
    [
        $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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal