function PluginManagerBase::getInstance
Same name and namespace in other branches
- 11.x core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::getInstance()
- 10 core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::getInstance()
- 8.9.x core/lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::getInstance()
Gets a preconfigured instance of a plugin.
Parameters
array $options: An array of options that can be used to determine a suitable plugin to instantiate and how to configure it.
Return value
object|false A fully configured plugin instance. The interface of the plugin instance will depend on the plugin type. If no instance can be retrieved, FALSE will be returned.
Overrides MapperInterface::getInstance
File
-
core/
lib/ Drupal/ Component/ Plugin/ PluginManagerBase.php, line 106
Class
- PluginManagerBase
- Base class for plugin managers.
Namespace
Drupal\Component\PluginCode
public function getInstance(array $options) {
if (!$this->mapper) {
throw new \BadMethodCallException(sprintf('%s does not support this method unless %s::$mapper is set.', static::class, static::class));
}
return $this->mapper
->getInstance($options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.