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

Breadcrumb

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

function DisplayPluginCollection::initializePlugin

Overrides DefaultLazyPluginCollection::initializePlugin

1 call to DisplayPluginCollection::initializePlugin()
DisplayPluginCollection::__construct in core/modules/views/src/DisplayPluginCollection.php
Constructs a DisplayPluginCollection object.

File

core/modules/views/src/DisplayPluginCollection.php, line 71

Class

DisplayPluginCollection
A class which wraps the displays of a view so you can lazy-initialize them.

Namespace

Drupal\views

Code

protected function initializePlugin($display_id) {
    // Retrieve and initialize the new display handler with data.
    $display =& $this->view->storage
        ->getDisplay($display_id);
    try {
        $this->configurations[$display_id] = $display;
        parent::initializePlugin($display_id);
    } catch (PluginException $e) {
        $message = $e->getMessage();
        \Drupal::messenger()->addWarning(t('@message', [
            '@message' => $message,
        ]));
    }
    // If no plugin instance has been created, return NULL.
    if (empty($this->pluginInstances[$display_id])) {
        return NULL;
    }
    $this->pluginInstances[$display_id]
        ->initDisplay($this->view, $display);
    // If this is not the default display handler, let it know which is since
    // it may well use some data from the default.
    if ($display_id != 'default') {
        $this->pluginInstances[$display_id]->default_display = $this->pluginInstances['default'];
    }
}

API Navigation

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