public function SelectionPluginManager::getPluginId in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getPluginId()
Gets the plugin ID for a given target entity type and base plugin ID.
Parameters
string $target_type: The target entity type.
string $base_plugin_id: The base plugin ID (e.g. 'default' or 'views').
Return value
string The plugin ID.
Overrides SelectionPluginManagerInterface::getPluginId
1 call to SelectionPluginManager::getPluginId()
- SelectionPluginManager::getInstance in core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionPluginManager.php - Gets a preconfigured instance of a plugin.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityReferenceSelection/ SelectionPluginManager.php, line 65 - Contains \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager.
Class
- SelectionPluginManager
- Plugin type manager for Entity Reference Selection plugins.
Namespace
Drupal\Core\Entity\EntityReferenceSelectionCode
public function getPluginId($target_type, $base_plugin_id) {
// Get all available selection plugins for this entity type.
$selection_handler_groups = $this
->getSelectionGroups($target_type);
// Sort the selection plugins by weight and select the best match.
uasort($selection_handler_groups[$base_plugin_id], array(
'Drupal\\Component\\Utility\\SortArray',
'sortByWeightElement',
));
end($selection_handler_groups[$base_plugin_id]);
$plugin_id = key($selection_handler_groups[$base_plugin_id]);
return $plugin_id;
}