function SelectionPluginManager::getInstance
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getInstance()
- 8.9.x core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getInstance()
- 11.x core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getInstance()
Overrides PluginManagerBase::getInstance
1 call to SelectionPluginManager::getInstance()
- SelectionPluginManager::getSelectionHandler in core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionPluginManager.php
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionPluginManager.php, line 35
Class
- SelectionPluginManager
- Plugin type manager for Entity Reference Selection plugins.
Namespace
Drupal\Core\Entity\EntityReferenceSelectionCode
public function getInstance(array $options) {
if (!isset($options['target_type'])) {
throw new \InvalidArgumentException("Missing required 'target_type' property for a EntityReferenceSelection plugin.");
}
// Initialize default options.
$options += [
'handler' => $this->getPluginId($options['target_type'], 'default'),
];
// A specific selection plugin ID was already specified.
if (str_contains($options['handler'], ':')) {
$plugin_id = $options['handler'];
}
else {
$plugin_id = $this->getPluginId($options['target_type'], $options['handler']);
}
unset($options['handler']);
return $this->createInstance($plugin_id, $options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.