EntityAutocompleteMatcherInterface.php

Same filename in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityAutocompleteMatcherInterface.php
  2. 10 core/lib/Drupal/Core/Entity/EntityAutocompleteMatcherInterface.php
  3. 11.x core/lib/Drupal/Core/Entity/EntityAutocompleteMatcherInterface.php

Namespace

Drupal\Core\Entity

File

core/lib/Drupal/Core/Entity/EntityAutocompleteMatcherInterface.php

View source
<?php

namespace Drupal\Core\Entity;

interface EntityAutocompleteMatcherInterface {
    
    /**
     * Gets matched labels based on a given search string.
     *
     * @param string $target_type
     *   The ID of the target entity type.
     * @param string $selection_handler
     *   The plugin ID of the entity reference selection handler.
     * @param array $selection_settings
     *   An array of settings that will be passed to the selection handler.
     * @param string $string
     *   (optional) The label of the entity to query by.
     *
     * @return array
     *   An array of matched entity labels, in the format required by the AJAX
     *   autocomplete API (e.g. array('value' => $value, 'label' => $label)).
     *
     * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
     *   Thrown when the current user doesn't have access to the specified entity.
     *
     * @see \Drupal\system\Controller\EntityAutocompleteController
     */
    public function getMatches($target_type, $selection_handler, $selection_settings, $string = '');

}

Interfaces

Title Deprecated Summary
EntityAutocompleteMatcherInterface

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