You are here

function search_api_autocomplete_access in Search API Autocomplete 7

Access callback for search autocompletion.

Parameters

SearchApiAutocompleteSearch $search: The autocomplete search which is being accessed.

object|null $account: (optional) The account to check, if not given use currently logged in user.

Return value

bool TRUE, if the search is enabled, supports autocompletion and the user has the necessary permission. FALSE otherwise.

2 calls to search_api_autocomplete_access()
SearchApiAutocompleteSearch::alterElement in ./search_api_autocomplete.entity.php
Helper method for altering a textfield form element to use autocompletion.
search_api_autocomplete_form_views_exposed_form_alter in ./search_api_autocomplete.search_api_views.inc
Implements hook_form_FORM_ID_alter().
1 string reference to 'search_api_autocomplete_access'
search_api_autocomplete_menu in ./search_api_autocomplete.module
Implements hook_menu().

File

./search_api_autocomplete.module, line 187
Adds autocomplete capabilities for Search API searches.

Code

function search_api_autocomplete_access(SearchApiAutocompleteSearch $search, $account = NULL) {
  return $search->enabled && user_access('use search_api_autocomplete for ' . $search->machine_name, $account) && $search
    ->supportsAutocompletion();
}