You are here

function hook_search_api_views_handler_mapping_alter in Search API 8

Alter the mapping of Search API data types to their default Views handlers.

Field handlers are not determined by these simplified (Search API) types, but by their actual property data types. For altering that mapping, see hook_search_api_views_field_handler_mapping_alter().

Parameters

array $mapping: An associative array with data types as the keys and Views table data definition items as the values. In addition to all normally defined Search API 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.

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 also

https://www.drupal.org/node/3059866

File

./search_api.api.php, line 214
Hooks provided by the Search API module.

Code

function hook_search_api_views_handler_mapping_alter(array &$mapping) {
  $mapping['entity:my_entity_type'] = [
    'argument' => [
      'id' => 'my_entity_type',
    ],
    'filter' => [
      'id' => 'my_entity_type',
    ],
    'sort' => [
      'id' => 'my_entity_type',
    ],
  ];
  $mapping['date']['filter']['id'] = 'my_date_filter';
}