function SelectionPluginManager::getSelectionHandler

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getSelectionHandler()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getSelectionHandler()
  3. 10 core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getSelectionHandler()

Overrides SelectionPluginManagerInterface::getSelectionHandler

File

core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php, line 94

Class

SelectionPluginManager
Plugin type manager for Entity Reference Selection plugins.

Namespace

Drupal\Core\Entity\EntityReferenceSelection

Code

public function getSelectionHandler(FieldDefinitionInterface $field_definition, ?EntityInterface $entity = NULL) {
    $options = $field_definition->getSetting('handler_settings') ?: [];
    $options += [
        'target_type' => $field_definition->getFieldStorageDefinition()
            ->getSetting('target_type'),
        'handler' => $field_definition->getSetting('handler'),
        'entity' => $entity,
    ];
    return $this->getInstance($options);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.