You are here

interface AutocompleteHelperInterface in Search API Autocomplete 8

Provides an interface for the autocomplete helper service.

Hierarchy

Expanded class hierarchy of AutocompleteHelperInterface

All classes that implement AutocompleteHelperInterface

1 file declares its use of AutocompleteHelperInterface
AutocompleteController.php in src/Controller/AutocompleteController.php

File

src/Utility/AutocompleteHelperInterface.php, line 12

Namespace

Drupal\search_api_autocomplete\Utility
View source
interface AutocompleteHelperInterface extends AccessInterface {

  /**
   * Splits a string with search keywords into two parts.
   *
   * The first part consists of all words the user has typed completely, the
   * second one contains the beginning of the last, possibly incomplete word.
   *
   * @param string $keys
   *   The passed in keys.
   *
   * @return string[]
   *   An array with $keys split into exactly two parts, both of which may be
   *   empty.
   */
  public function splitKeys($keys);

  /**
   * Alters a textfield form element to use autocompletion.
   *
   * @param array $element
   *   The altered element.
   * @param \Drupal\search_api_autocomplete\SearchInterface $search
   *   The autocomplete search.
   * @param array $data
   *   (optional) Additional data to pass to the autocomplete callback.
   */
  public function alterElement(array &$element, SearchInterface $search, array $data = []);

  /**
   * Checks access to the autocompletion route.
   *
   * @param \Drupal\search_api_autocomplete\SearchInterface $search_api_autocomplete_search
   *   The configured autocompletion search.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The account.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access(SearchInterface $search_api_autocomplete_search, AccountInterface $account);

}

Members

Namesort descending Modifiers Type Description Overrides
AutocompleteHelperInterface::access public function Checks access to the autocompletion route. 1
AutocompleteHelperInterface::alterElement public function Alters a textfield form element to use autocompletion. 1
AutocompleteHelperInterface::splitKeys public function Splits a string with search keywords into two parts. 1