You are here

protected function DisplayPluginCollection::initializePlugin in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/DisplayPluginCollection.php \Drupal\views\DisplayPluginCollection::initializePlugin()

Initializes and stores a plugin.

Parameters

string $instance_id: The ID of the plugin instance to initialize.

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 76
Contains \Drupal\views\DisplayPluginCollection.

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_set_message(t('@message', array(
      '@message' => $message,
    )), 'warning');
  }

  // 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'];
  }
}