function _search_api_views_handler_mapping in Search API 8
Determines the mapping of Search API data types to their Views handlers.
Return value
array An associative array with data types as the keys and Views field data definitions as the values. In addition to all normally defined data types, keys can also be "options" for any field with an options list, "entity" for general entity-typed fields or "entity:ENTITY_TYPE" (with "ENTITY_TYPE" being the machine name of an entity type) for entities of that type.
See also
search_api_views_handler_mapping_alter()
1 call to _search_api_views_handler_mapping()
- _search_api_views_get_handlers in ./
search_api.views.inc - Returns the Views handlers to use for a given field.
File
- ./
search_api.views.inc, line 271 - Views hook implementations for the Search API module.
Code
function _search_api_views_handler_mapping() {
$mapping =& drupal_static(__FUNCTION__);
if ($mapping === NULL) {
$mapping = [
'boolean' => [
'argument' => [
'id' => 'search_api',
],
'filter' => [
'id' => 'search_api_boolean',
],
'sort' => [
'id' => 'search_api',
],
],
'date' => [
'argument' => [
'id' => 'search_api_date',
],
'filter' => [
'id' => 'search_api_date',
],
'sort' => [
'id' => 'search_api',
],
],
'decimal' => [
'argument' => [
'id' => 'search_api',
'filter' => 'floatval',
],
'filter' => [
'id' => 'search_api_numeric',
],
'sort' => [
'id' => 'search_api',
],
],
'integer' => [
'argument' => [
'id' => 'search_api',
'filter' => 'intval',
],
'filter' => [
'id' => 'search_api_numeric',
],
'sort' => [
'id' => 'search_api',
],
],
'string' => [
'argument' => [
'id' => 'search_api',
],
'filter' => [
'id' => 'search_api_string',
],
'sort' => [
'id' => 'search_api',
],
],
'text' => [
'argument' => [
'id' => 'search_api',
],
'filter' => [
'id' => 'search_api_text',
],
'sort' => [
'id' => 'search_api',
],
],
'language' => [
'argument' => [
'id' => 'search_api',
],
'filter' => [
'id' => 'search_api_language',
'allow empty' => FALSE,
],
'sort' => [
'id' => 'search_api',
],
],
'options' => [
'argument' => [
'id' => 'search_api',
],
'filter' => [
'id' => 'search_api_options',
],
'sort' => [
'id' => 'search_api',
],
],
'entity:taxonomy_term' => [
'argument' => [
'id' => 'search_api_term',
],
'filter' => [
'id' => 'search_api_term',
],
'sort' => [
'id' => 'search_api',
],
],
'entity:user' => [
'argument' => [
'id' => 'search_api',
'filter' => 'intval',
],
'filter' => [
'id' => 'search_api_user',
],
'sort' => [
'id' => 'search_api',
],
],
'bundle_of' => [
'argument' => [
'id' => 'search_api',
],
'filter' => [
'id' => 'search_api_options',
],
'sort' => [
'id' => 'search_api',
],
],
];
$alter_id = 'search_api_views_handler_mapping';
$description = 'This hook is deprecated in search_api:8.x-1.14 and is removed from search_api:2.0.0. Please use the "search_api.mapping_views_handlers" event instead. See https://www.drupal.org/node/3059866';
\Drupal::moduleHandler()
->alterDeprecated($description, $alter_id, $mapping);
$event = new MappingViewsHandlersEvent($mapping);
\Drupal::getContainer()
->get('event_dispatcher')
->dispatch(SearchApiEvents::MAPPING_VIEWS_HANDLERS, $event);
}
return $mapping;
}