function EntityReference::getSubHandlerOptions

Get all selection plugins for this entity type.

Return value

string[] The selection handlers available for the target entity ID of the filter.

3 calls to EntityReference::getSubHandlerOptions()
EntityReference::buildExtraOptionsForm in core/modules/views/src/Plugin/views/filter/EntityReference.php
Provide a form for setting options.
EntityReference::submitExtraOptionsForm in core/modules/views/src/Plugin/views/filter/EntityReference.php
Perform any necessary changes to the form values prior to storage.
EntityReference::validateExtraOptionsForm in core/modules/views/src/Plugin/views/filter/EntityReference.php
Validate the options form.

File

core/modules/views/src/Plugin/views/filter/EntityReference.php, line 166

Class

EntityReference
Filters a view by entity references.

Namespace

Drupal\views\Plugin\views\filter

Code

protected function getSubHandlerOptions() : array {
  if ($this->handlerOptions) {
    return $this->handlerOptions;
  }
  $entity_type = $this->getReferencedEntityType();
  $selection_plugins = $this->selectionPluginManager
    ->getSelectionGroups($entity_type->id());
  $this->handlerOptions = [];
  foreach (array_keys($selection_plugins) as $selection_group_id) {
    // We only display base plugins (e.g. 'default', 'views', ...).
    if (array_key_exists($selection_group_id, $selection_plugins[$selection_group_id])) {
      $this->handlerOptions[$selection_group_id] = (string) $selection_plugins[$selection_group_id][$selection_group_id]['label'];
    }
    elseif (array_key_exists($selection_group_id . ':' . $entity_type->id(), $selection_plugins[$selection_group_id])) {
      $selection_group_plugin = $selection_group_id . ':' . $entity_type->id();
      $this->handlerOptions[$selection_group_plugin] = (string) $selection_plugins[$selection_group_id][$selection_group_plugin]['base_plugin_label'];
    }
  }
  return $this->handlerOptions;
}

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