function facetapi_token_info in Facet API 7.2
Same name and namespace in other branches
- 7 facetapi.tokens.inc \facetapi_token_info()
Implements hook_token_info().
File
- ./
facetapi.tokens.inc, line 11 - Builds placeholder replacement tokens for searches.
Code
function facetapi_token_info() {
$types = $results = $active = $facet = array();
// The types of tokens.
$types['facetapi_results'] = array(
'name' => t('Search results'),
'description' => t('Tokens related to the search query and response.'),
'needs-data' => 'facetapi_adapter',
);
$types['facetapi_active'] = array(
'name' => t('Active facet items'),
'description' => t('Tokens related to active facet items.'),
'needs-data' => 'facetapi_active_item',
);
$types['facetapi_facet'] = array(
'name' => t('Facet field'),
'description' => t('Tokens related to a facet field.'),
'needs-data' => 'facetapi_facet',
);
// Tokens related to search results and response.
$results['keys'] = array(
'name' => t('Search keywords'),
'description' => t('The search keywords entered by the user.'),
);
$results['page-number'] = array(
'name' => t('Page number'),
'description' => t('The page number of the result set.'),
);
$results['page-limit'] = array(
'name' => t('Page limit'),
'description' => t('The number of results displayed per page.'),
);
$results['page-total'] = array(
'name' => t('Page total'),
'description' => t('The total number of pages in the result set.'),
);
$results['offset'] = array(
'name' => t('Offset'),
'description' => t('The zero-based offset of the first element on the search page.'),
);
$results['start-count'] = array(
'name' => t('Start count'),
'description' => t('The number of the first item on the page.'),
);
$results['end-count'] = array(
'name' => t('End count'),
'description' => t('The number of the last item on the page.'),
);
$results['result-count'] = array(
'name' => t('Result count'),
'description' => t('The total number of results matched by the search query.'),
);
$results['search-path'] = array(
'name' => t('Search path'),
'description' => t('Path to the current page without any filter'),
);
// Tokens related to active facet items.
$active['active-value'] = array(
'name' => t('Mapped value'),
'description' => t('The mapped value of the active item.'),
);
$active['active-value-raw'] = array(
'name' => t('Raw value'),
'description' => t('The raw value of the active item as stored in the index.'),
);
$active['active-pos'] = array(
'name' => t('Position'),
'description' => t('The zero-based position of the active item.'),
);
$active['facet-label'] = array(
'name' => t('Facet label'),
'description' => t('The human readable label of the active item\'s facet.'),
);
$active['facet-name'] = array(
'name' => t('Facet name'),
'description' => t('The machine readable name of the active item\'s facet.'),
);
// Tokens related to a facet.
$facet['facet-label'] = array(
'name' => t('Facet label'),
'description' => t('The human readable label of the active item\'s facet.'),
);
$facet['facet-name'] = array(
'name' => t('Facet name'),
'description' => t('The machine readable name of the active item\'s facet.'),
);
return array(
'types' => $types,
'tokens' => array(
'facetapi_results' => $results,
'facetapi_active' => $active,
'facetapi_facet' => $facet,
),
);
}