View source
<?php
function contextphp_context_registry() {
$registry = array();
$registry['conditions'] = array(
'php' => array(
'title' => t('PHP code'),
'plugin' => 'contextphp_condition_php',
),
);
$registry['reactions'] = array(
'php' => array(
'title' => t('PHP code'),
'plugin' => 'contextphp_reaction_php',
),
);
return $registry;
}
function contextphp_context_plugins() {
$plugins = array();
$plugins['contextphp_condition_php'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'contextphp') . '/plugins',
'file' => 'contextphp_condition_php.inc',
'class' => 'contextphp_condition_php',
'parent' => 'context_condition',
),
);
$plugins['contextphp_reaction_php'] = array(
'handler' => array(
'path' => drupal_get_path('module', 'contextphp') . '/plugins',
'file' => 'contextphp_reaction_php.inc',
'class' => 'contextphp_reaction_php',
'parent' => 'context_reaction',
),
);
return $plugins;
}
function contextphp_init() {
$map = context_condition_map();
if (!empty($map['php']) && ($plugin = context_get_plugin('condition', 'php'))) {
$plugin
->execute();
}
$map = context_reactions();
if (!empty($map['php']) && ($plugin = context_get_plugin('reaction', 'php'))) {
$plugin
->execute();
}
}