This project is not covered by Drupal’s security advisory policy.
A small module to allow your own callbacks for activating and reacting to contexts (context module). No need to write a context-plugin; this module provides a simple hook to register the callbacks and/or reactions that will be picked up by context.
Installation
Context Callback can be installed like any other Drupal module: place it in the modules directory for your site and enable it on the `admin/modules` page.
Usage
Implement the `hook_context_callback_info` hook in your own module. With this hook, you let the Context Callback know of your callback functions.
Each callback will be called upon page-view to see whether or not it should trigger the context.
Example code
// mymodule.module
/**
* Implements hook_context_callback_info().
*/
function mymodule_context_callback_info() {
return array(
'conditions' => array(
'mymodule_condition_callback_id' => array(
'label' => 'MyModule Callback Example',
'callback' => 'mymodule_condition_callback_example',
// Optional.
'callback arguments' => array(
'argument 1',
'argument 2',
),
),
),
'reactions' => array(
'mymodule_reaction_callback_id' => array(
'label' => 'MyModule Callback Example',
'callback' => 'mymodule_reaction_callback_example',
// Optional.
'callback arguments' => array(
'argument 1',
'argument 2',
),
),
),
);
}
/**
* Callback example function.
*/
function mymodule_condition_callback_example($argument1, $argument2) {
if (/* Do some checks to see if the context should trigger */) {
return TRUE;
}
return FALSE;
}
/**
* Callback example function.
*/
function mymodule_reaction_callback_example($argument1, $argument2) {
/* Do something awesome */
}
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - No further development
No longer developed by its maintainers. - Module categories: Developer Tools
- 4 sites report using this module
- Created by SpadXIII on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
Releases
Development version: 7.x-1.x-dev updated 8 Feb 2016 at 07:58 UTC