You are here

public function ViewsHandlerManager::createInstance in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/ViewsHandlerManager.php \Drupal\views\Plugin\ViewsHandlerManager::createInstance()

Creates a pre-configured instance of a plugin.

Parameters

string $plugin_id: The ID of the plugin being instantiated.

array $configuration: An array of configuration relevant to the plugin instance.

Return value

object A fully configured plugin instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.

Overrides PluginManagerBase::createInstance

1 call to ViewsHandlerManager::createInstance()
ViewsHandlerManager::getHandler in core/modules/views/src/Plugin/ViewsHandlerManager.php
Fetches a handler from the data cache.

File

core/modules/views/src/Plugin/ViewsHandlerManager.php, line 125
Contains \Drupal\views\Plugin\ViewsHandlerManager.

Class

ViewsHandlerManager
Plugin type manager for all views handlers.

Namespace

Drupal\views\Plugin

Code

public function createInstance($plugin_id, array $configuration = array()) {
  $instance = parent::createInstance($plugin_id, $configuration);
  if ($instance instanceof HandlerBase) {
    $instance
      ->setModuleHandler($this->moduleHandler);
    $instance
      ->setViewsData($this->viewsData);
  }
  return $instance;
}