Callbacks

Callback function signatures.

Drupal's API sometimes uses callback functions to allow you to define how some type of processing happens. A callback is a function with a defined signature, which you define in a module. Then you pass the function name as a parameter to a Drupal API function or return it as part of a hook implementation return value, and your function is called at an appropriate time. For instance, when setting up batch processing you might need to provide a callback function for each processing step and/or a callback for when processing is finished; you would do that by defining these functions and passing their names into the batch setup function.

Callback function signatures, like hook definitions, are described by creating and documenting dummy functions in a *.api.php file; normally, the dummy callback function's name should start with "callback_", and you should document the parameters and return value and provide a sample function body. Then your API documentation can refer to this callback function in its documentation. A user of your API can usually name their callback function anything they want, although a standard name would be to replace "callback_" with the module name.

See also

Hooks

Default theme implementations

Parent topics

File

drupal/includes/module.inc, line 637
API for loading and interacting with Drupal modules.

Functions

Namesort descending Location Description
callback_batch_finished drupal/modules/system/form.api.php Complete a batch process.
callback_batch_operation drupal/modules/system/form.api.php Perform a single batch operation.
callback_entity_info_label drupal/modules/system/system.api.php Return the label of an entity.
callback_entity_info_language drupal/modules/system/system.api.php Return the language code of the entity.
callback_entity_info_uri drupal/modules/system/system.api.php Return the URI for an entity.
callback_filter_prepare drupal/modules/filter/filter.api.php Provide prepared text with special characters escaped.
callback_filter_process drupal/modules/filter/filter.api.php Provide text filtered to conform to the supplied format.
callback_filter_settings drupal/modules/filter/filter.api.php Provide a settings form for filter settings.
callback_filter_tips drupal/modules/filter/filter.api.php Return help text for a filter.
callback_queue_worker drupal/modules/system/system.api.php Work on a single queue item.
callback_search_conditions drupal/modules/search/search.api.php Provide search query conditions.