public function PluginManagerBase::getInstance in Service Container 7.2
Same name in this branch
- 7.2 src/Plugin/PluginManagerBase.php \Drupal\service_container\Plugin\PluginManagerBase::getInstance()
- 7.2 lib/Drupal/Component/Plugin/PluginManagerBase.php \Drupal\Component\Plugin\PluginManagerBase::getInstance()
Same name and namespace in other branches
- 7 src/Plugin/PluginManagerBase.php \Drupal\service_container\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 depends on the plugin type. If no instance can be retrieved, FALSE will be returned.
Overrides MapperInterface::getInstance
File
- src/
Plugin/ PluginManagerBase.php, line 77 - Contains \Drupal\service_container\Plugin\PluginManagerBase
Class
- PluginManagerBase
- Base class for plugin managers.
Namespace
Drupal\service_container\PluginCode
public function getInstance(array $options) {
// 90% of core does not use the generic $mapper functionality, so use a
// sane default function.
if (isset($options['id'])) {
return $this
->createInstance($options['id']);
}
return FALSE;
}