You are here

public function OgSelection::getSelectionHandler in Organic groups 8

Get the selection handler of the field.

Return value

\Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection Returns the selection handler.

File

src/Plugin/EntityReferenceSelection/OgSelection.php, line 35

Class

OgSelection
Provide default OG selection handler.

Namespace

Drupal\og\Plugin\EntityReferenceSelection

Code

public function getSelectionHandler() {
  $options = $this
    ->getConfiguration();

  // The 'handler' key intentionally absent as we want the selection manager
  // to choose the best option.
  // @see \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager::getInstance()
  unset($options['handler']);

  // Remove also the backwards compatibility layer because that will be passed
  // to the chosen selection handler setter and, as an effect, will trigger a
  // deprecation notice.
  // @see \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginBase::resolveBackwardCompatibilityConfiguration()
  unset($options['handler_settings']);
  return \Drupal::service('plugin.manager.entity_reference_selection')
    ->getInstance($options);
}