123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
- function hook_context_plugins() {
- $plugins = array();
- $plugins['foo_context_condition_bar'] = array(
- 'handler' => array(
- 'path' => drupal_get_path('module', 'foo') .'/plugins',
- 'file' => 'foo_context_condition_bar.inc',
- 'class' => 'foo_context_condition_bar',
- 'parent' => 'context_condition',
- ),
- );
- $plugins['foo_context_reaction_baz'] = array(
- 'handler' => array(
- 'path' => drupal_get_path('module', 'foo') .'/plugins',
- 'file' => 'foo_context_reaction_baz.inc',
- 'class' => 'foo_context_reaction_baz',
- 'parent' => 'context_reaction',
- ),
- );
- return $plugins;
- }
- function hook_context_registry() {
- return array(
- 'conditions' => array(
- 'bar' => array(
- 'title' => t('Name of condition "bar"'),
- 'plugin' => 'foo_context_condition_bar',
- ),
- ),
- 'reactions' => array(
- 'baz' => array(
- 'title' => t('Name of reaction "baz"'),
- 'plugin' => 'foo_context_reaction_baz',
- ),
- ),
- );
- }
- function hook_context_page_condition() {
- if ($plugin = context_get_plugin('condition', 'bar')) {
- $plugin->execute();
- }
- }
- function hook_context_page_reaction() {
- if ($plugin = context_get_plugin('reaction', 'baz')) {
- $plugin->execute();
- }
- }
- function hook_context_registry_alter(&$registry) {
- if (isset($registry['reactions']['baz'])) {
- $registry['reactions']['baz']['plugin'] = 'custom_context_reaction_baz';
- }
- }
- function hook_context_node_condition_alter(&$node, $op) {
- if ($plugin = context_get_plugin('condition', 'bar')) {
- $plugin->execute($node, $op);
- }
- }
- function hook_context_load_alter(&$context) {
- if ($context->name === 'foo' && isset($context->reactions['block'])) {
- $context->reactions['block']['blocks']['locale-0'] = array(
- 'module' => 'locale',
- 'delta' => '0',
- 'region' => 'header',
- 'weight' => '2',
- );
- }
- }
- function hook_context_allow_ajax_block_access($block_id) {
- }
|