EntityAutocompleteMatcherInterface.php

Namespace

Drupal\Core\Entity

File

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

View source
<?php

namespace Drupal\Core\Entity;


/**
 * Provides an interface for the entity autocomplete matcher.
 */
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. For example, [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 Provides an interface for the entity autocomplete matcher.

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