You are here

function hook_search_api_alter_callback_info in Search API 7

Define available data alterations.

Registers one or more callbacks that can be called at index time to add additional data to the indexed items (e.g. comments or attachments to nodes), alter the data in other forms or remove items from the array.

Data-alter callbacks (which are called "Data alterations" in the UI) are classes implementing the SearchApiAlterCallbackInterface interface.

Return value

array An associative array keyed by the callback IDs and containing arrays with the following keys:

  • name: The name to display for this callback.
  • description: A short description of what the callback does.
  • class: The callback class.
  • weight: (optional) Defines the order in which callbacks are displayed (and, therefore, invoked) by default. Defaults to 0.

See also

SearchApiAlterCallbackInterface

1 function implements hook_search_api_alter_callback_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_search_api_alter_callback_info in ./search_api.module
Implements hook_search_api_alter_callback_info().
1 invocation of hook_search_api_alter_callback_info()
search_api_get_alter_callbacks in ./search_api.module
Returns a list of all available data alter callbacks.

File

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

Code

function hook_search_api_alter_callback_info() {
  $callbacks['example_random_alter'] = array(
    'name' => t('Random alteration'),
    'description' => t('Alters all passed item data completely randomly.'),
    'class' => 'ExampleRandomAlter',
    'weight' => 100,
  );
  $callbacks['example_add_comments'] = array(
    'name' => t('Add comments'),
    'description' => t('For nodes and similar entities, adds comments.'),
    'class' => 'ExampleAddComments',
  );
  return $callbacks;
}