I want to create a simple context reaction. Basically, when a condition is met, use drupal_set_message to say "Hello World."
I am using version 7.x-3.0-alpha2 of the Context module, and Drupal 7 Beta 2.
Here is the code I have in my module:
context_helloworld.module:
function context_helloworld_context_plugins() {
$plugins = array();
$plugins['context_helloworld_context'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'context_helloworld.context'),
'file' => 'context_helloworld.context.inc',
'class' => 'context_helloworld_reaction_helloworld',
'parent' => 'context_reaction',
),
);
return $plugins;
}
function context_helloworld_context_registry() {
return array(
'reactions' => array(
'bar' => array(
'title' => t('Hello World Reaction'),
'plugin' => 'context_helloworld_context',
),
),
);
}
context_helloworld.context.inc:
class context_helloworld_reaction extends context_reaction {
function execute(&$vars = NULL){
drupal_set_message(t("Hello World from a context reacation."));
}
}
If I have the module enabled, it gives me a white screen when I try to add a new context.
Of course, without my module enabled, it works fine.