public function DisplayPluginBase::getPlugin

Get the instance of a plugin, for example style or row.

Parameters

string $type: The type of the plugin.

Return value

\Drupal\views\Plugin\views\PluginBase

13 calls to DisplayPluginBase::getPlugin()
DisplayPluginBase::access in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Determine if the user has access to this display of the view.
DisplayPluginBase::buildOptionsForm in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Provide the default form for setting options.
DisplayPluginBase::isPagerEnabled in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Whether the display is using a pager or not.
DisplayPluginBase::mergePlugin in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Merges plugins default values.
DisplayPluginBase::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Provide the default summary for options in the views UI.

... See full list

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php, line 811
Contains Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Namespace

Drupal\views\Plugin\views\display

Code

public function getPlugin($type) {

  // Look up the plugin name to use for this instance.
  $options = $this
    ->getOption($type);

  // Return now if no options have been loaded.
  if (empty($options) || !isset($options['type'])) {
    return;
  }

  // Query plugins allow specifying a specific query class per base table.
  if ($type == 'query') {
    $views_data = Views::viewsData()
      ->get($this->view->storage
      ->get('base_table'));
    $name = isset($views_data['table']['base']['query_id']) ? $views_data['table']['base']['query_id'] : 'views_query';
  }
  else {
    $name = $options['type'];
  }

  // Plugin instances are stored on the display for re-use.
  if (!isset($this->plugins[$type][$name])) {
    $plugin = Views::pluginManager($type)
      ->createInstance($name);

    // Initialize the plugin.
    $plugin
      ->init($this->view, $this, $options['options']);
    $this->plugins[$type][$name] = $plugin;
  }
  return $this->plugins[$type][$name];
}