You are here

function search_api_saved_searches_token_info in Search API Saved Searches 8

Same name and namespace in other branches
  1. 7 search_api_saved_searches.tokens.inc \search_api_saved_searches_token_info()

Implements hook_token_info().

File

./search_api_saved_searches.tokens.inc, line 16
Builds placeholder replacement tokens for saved searches.

Code

function search_api_saved_searches_token_info() {
  $types['search-api-saved-search'] = [
    'name' => t('Search API saved search'),
    'description' => t('Tokens related to a saved search.'),
    'needs-data' => 'search_api_saved_search',
  ];
  $types['search-api-saved-search-results'] = [
    'name' => t('Search API saved search results'),
    'description' => t('Tokens related to a saved search result set.'),
    'needs-data' => 'search_api_results',
  ];
  $tokens['user']['search-api-saved-searches-url'] = [
    'name' => t('Search API Saved Searches configuration URL'),
    'description' => t('The URL under which a user can configure her saved searches.'),
    'type' => 'url',
  ];
  $tokens['search-api-saved-search']['id'] = [
    'name' => t('ID'),
    'description' => t('The ID of the saved search.'),
  ];
  $tokens['search-api-saved-search']['label'] = [
    'name' => t('Label'),
    'description' => t('The label for the saved search.'),
  ];
  $tokens['search-api-saved-search']['owner'] = [
    'name' => t('Owner'),
    'description' => t('The owner of the saved search.'),
    'type' => 'user',
  ];
  $tokens['search-api-saved-search']['created'] = [
    'name' => t('Date created'),
    'description' => t('The date on which the saved search was created.'),
    'type' => 'date',
  ];
  $tokens['search-api-saved-search']['view-url'] = [
    'name' => t('View URL'),
    'description' => t('The URL of the page displaying this search, if any.'),
    'type' => 'url',
  ];
  $tokens['search-api-saved-search']['activate-url'] = [
    'name' => t('Activate URL'),
    'description' => t('The URL where the saved search can be activated (if necessary).'),
    'type' => 'url',
  ];
  $tokens['search-api-saved-search']['edit-url'] = [
    'name' => t('Edit URL'),
    'description' => t('The URL for editing the saved search.'),
    'type' => 'url',
  ];
  $tokens['search-api-saved-search']['delete-url'] = [
    'name' => t('Delete URL'),
    'description' => t('The URL for deleting the saved search.'),
    'type' => 'url',
  ];
  $tokens['search-api-saved-search-results']['count'] = [
    'name' => t('Result count'),
    'description' => t('The number of results.'),
  ];
  $tokens['search-api-saved-search-results']['links'] = [
    'name' => t('Links'),
    'description' => t('Plain-text links to the search results.'),
  ];
  return [
    'types' => $types,
    'tokens' => $tokens,
  ];
}