public function SelectionPluginManager::getSelectionGroups in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getSelectionGroups()
Gets the selection plugins that can reference a specific entity type.
Parameters
string $entity_type_id: A Drupal entity type ID.
Return value
array An array of selection plugins grouped by selection group.
Overrides SelectionPluginManagerInterface::getSelectionGroups
1 call to SelectionPluginManager::getSelectionGroups()
- SelectionPluginManager::getPluginId in core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionPluginManager.php - Gets the plugin ID for a given target entity type and base plugin ID.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionPluginManager.php, line 75
Class
- SelectionPluginManager
- Plugin type manager for Entity Reference Selection plugins.
Namespace
Drupal\Core\Entity\EntityReferenceSelectionCode
public function getSelectionGroups($entity_type_id) {
$plugins = [];
$definitions = $this
->getDefinitions();
// Do not display the 'broken' plugin in the UI.
unset($definitions['broken']);
foreach ($definitions as $plugin_id => $plugin) {
if (empty($plugin['entity_types']) || in_array($entity_type_id, $plugin['entity_types'])) {
$plugins[$plugin['group']][$plugin_id] = $plugin;
}
}
return $plugins;
}