class EntityAutocompleteMatcher implements EntityAutocompleteMatcherInterface (View source)

Matcher class to get autocompletion results for entity reference.

Properties

protected SelectionPluginManagerInterface $selectionManager

The entity reference selection handler plugin manager.

Methods

__construct(SelectionPluginManagerInterface $selection_manager)

Constructs an EntityAutocompleteMatcher object.

array
getMatches(string $target_type, string $selection_handler, array $selection_settings, string $string = '')

Gets matched labels based on a given search string.

Details

__construct(SelectionPluginManagerInterface $selection_manager)

Constructs an EntityAutocompleteMatcher object.

Parameters

SelectionPluginManagerInterface $selection_manager

The entity reference selection handler plugin manager.

array getMatches(string $target_type, string $selection_handler, array $selection_settings, string $string = '')

Gets matched labels based on a given search string.

Parameters

string $target_type

The ID of the target entity type.

string $selection_handler

The plugin ID of the entity reference selection handler.

array $selection_settings

An array of settings that will be passed to the selection handler.

string $string

(optional) The label of the entity to query by.

Return Value

array

An array of matched entity labels, in the format required by the AJAX autocomplete API (e.g. array('value' => $value, 'label' => $label)).

Exceptions

AccessDeniedHttpException