You are here

public function SelectionPluginManager::getSelectionGroups in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 80
Contains \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager.

Class

SelectionPluginManager
Plugin type manager for Entity Reference Selection plugins.

Namespace

Drupal\Core\Entity\EntityReferenceSelection

Code

public function getSelectionGroups($entity_type_id) {
  $plugins = array();
  $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;
}