You are here

function hook_search_api_service_info in Search API 7

Defines one or more search service classes a module offers.

Note: The ids should be valid PHP identifiers.

Return value

array An associative array of search service classes, keyed by a unique identifier and containing associative arrays with the following keys:

  • name: The service class' translated name.
  • description: A translated string to be shown to administrators when selecting a service class. Should contain all peculiarities of the service class, like field type support, supported features (like facets), the "direct" parse mode and other specific things to keep in mind. The text can contain HTML.
  • class: The service class, which has to implement the SearchApiServiceInterface interface.

See also

hook_search_api_service_info_alter()

2 functions implement hook_search_api_service_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

search_api_test_2_search_api_service_info in tests/search_api_test_2.module
Implements hook_search_api_service_info().
search_api_test_search_api_service_info in tests/search_api_test.module
Implements hook_search_api_service_info().
3 invocations of hook_search_api_service_info()
search_api_features_export_alter in ./search_api.module
Implements hook_features_export_alter().
search_api_get_service_info in ./search_api.module
Returns either a list of all available service infos, or a specific one.
search_api_system_info_alter in ./search_api.module
Implements hook_system_info_alter().

File

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

Code

function hook_search_api_service_info() {
  $services['example_some'] = array(
    'name' => t('Some Service'),
    'description' => t('Service for some search engine.'),
    'class' => 'SomeServiceClass',
    // Unknown keys can later be read by the object for additional information.
    'init args' => array(
      'foo' => 'Foo',
      'bar' => 42,
    ),
  );
  $services['example_other'] = array(
    'name' => t('Other Service'),
    'description' => t('Service for another search engine.'),
    'class' => 'OtherServiceClass',
  );
  return $services;
}