function PluginManagerBase::handlePluginNotFound

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::handlePluginNotFound()
  2. 8.9.x core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::handlePluginNotFound()
  3. 10 core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::handlePluginNotFound()

Allows plugin managers to specify custom behavior if a plugin is not found.

Parameters

string $plugin_id: The ID of the missing requested plugin.

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

Return value

object A fallback plugin instance.

Throws

\BadMethodCallException When ::getFallbackPluginId() is not implemented in the concrete plugin manager class.

2 calls to PluginManagerBase::handlePluginNotFound()
BlockManager::handlePluginNotFound in core/lib/Drupal/Core/Block/BlockManager.php
Allows plugin managers to specify custom behavior if a plugin is not found.
PluginManagerBase::createInstance in core/lib/Drupal/Component/Plugin/PluginManagerBase.php
1 method overrides PluginManagerBase::handlePluginNotFound()
BlockManager::handlePluginNotFound in core/lib/Drupal/Core/Block/BlockManager.php
Allows plugin managers to specify custom behavior if a plugin is not found.

File

core/lib/Drupal/Component/Plugin/PluginManagerBase.php, line 102

Class

PluginManagerBase
Base class for plugin managers.

Namespace

Drupal\Component\Plugin

Code

protected function handlePluginNotFound($plugin_id, array $configuration) {
    $fallback_id = $this->getFallbackPluginId($plugin_id, $configuration);
    return $this->getFactory()
        ->createInstance($fallback_id, $configuration);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.