context.api.php

  1. cis7 sites/all/modules/ulmus/context/context.api.php
  2. cle7 sites/all/modules/ulmus/context/context.api.php
  3. ecd7 sites/all/modules/ulmus/context/context.api.php
  4. elmsmedia7 sites/all/modules/ulmus/context/context.api.php
  5. harmony7 sites/all/modules/ulmus/context/context.api.php
  6. icor7 sites/all/modules/ulmus/context/context.api.php
  7. meedjum_blog7 sites/all/modules/ulmus/context/context.api.php
  8. mooc7 sites/all/modules/ulmus/context/context.api.php

Hooks provided by Context.

Functions

Namesort descending Description
hook_context_allow_ajax_block_access Allows for finer grained access mechanisms to using the json rendering capabilities of the block reaction when a user isn't granted the administer contexts or context ajax block access permission
hook_context_load_alter Alter a context directly after it has been loaded. Allows modules to alter a context object's reactions. While you may alter conditions, this will generally have no effect as conditions are cached for performance and contexts are loaded after…
hook_context_node_condition_alter Alter/add a condition to a node-related event.
hook_context_page_condition Execute Context page conditions
hook_context_page_reaction Execute Context page reactions
hook_context_plugins CTools plugin API hook for Context. Note that a proper entry in hook_ctools_plugin_api() must exist for this hook to be called.
hook_context_registry Registry hook for conditions & reactions.
hook_context_registry_alter Alter the registry.

File

sites/all/modules/ulmus/context/context.api.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by Context.
  5. */
  6. /**
  7. * CTools plugin API hook for Context. Note that a proper entry in
  8. * hook_ctools_plugin_api() must exist for this hook to be called.
  9. */
  10. function hook_context_plugins() {
  11. $plugins = array();
  12. $plugins['foo_context_condition_bar'] = array(
  13. 'handler' => array(
  14. 'path' => drupal_get_path('module', 'foo') .'/plugins',
  15. 'file' => 'foo_context_condition_bar.inc',
  16. 'class' => 'foo_context_condition_bar',
  17. 'parent' => 'context_condition',
  18. ),
  19. );
  20. $plugins['foo_context_reaction_baz'] = array(
  21. 'handler' => array(
  22. 'path' => drupal_get_path('module', 'foo') .'/plugins',
  23. 'file' => 'foo_context_reaction_baz.inc',
  24. 'class' => 'foo_context_reaction_baz',
  25. 'parent' => 'context_reaction',
  26. ),
  27. );
  28. return $plugins;
  29. }
  30. /**
  31. * Registry hook for conditions & reactions.
  32. *
  33. * Each entry associates a condition or reaction with the CTools plugin to be
  34. * used as its plugin class.
  35. */
  36. function hook_context_registry() {
  37. return array(
  38. 'conditions' => array(
  39. 'bar' => array(
  40. 'title' => t('Name of condition "bar"'),
  41. 'plugin' => 'foo_context_condition_bar',
  42. ),
  43. ),
  44. 'reactions' => array(
  45. 'baz' => array(
  46. 'title' => t('Name of reaction "baz"'),
  47. 'plugin' => 'foo_context_reaction_baz',
  48. ),
  49. ),
  50. );
  51. }
  52. /**
  53. * Execute Context page conditions
  54. *
  55. * Allows modules to hook into Context's hook_page_build to execute their
  56. * conditions at an appropriate time before the firing of reactions.
  57. */
  58. function hook_context_page_condition() {
  59. if ($plugin = context_get_plugin('condition', 'bar')) {
  60. $plugin->execute();
  61. }
  62. }
  63. /**
  64. * Execute Context page reactions
  65. *
  66. * Allows modules to hook into Context's hook_page_build to execute their
  67. * reactions at an appropriate time after the firing of conditions.
  68. */
  69. function hook_context_page_reaction() {
  70. if ($plugin = context_get_plugin('reaction', 'baz')) {
  71. $plugin->execute();
  72. }
  73. }
  74. /**
  75. * Alter the registry.
  76. *
  77. * Allows modules to alter the registry. Default plugins can be replaced by
  78. * custom ones declared in hook_context_plugins().
  79. *
  80. * @param $registry
  81. * The registry, passed by reference.
  82. */
  83. function hook_context_registry_alter(&$registry) {
  84. if (isset($registry['reactions']['baz'])) {
  85. $registry['reactions']['baz']['plugin'] = 'custom_context_reaction_baz';
  86. }
  87. }
  88. /**
  89. * Alter/add a condition to a node-related event.
  90. *
  91. * Allows modules to add one or more context condition plugin executions to a
  92. * node view, form, etc.
  93. *
  94. * @param $node
  95. * The node object.
  96. * @param $op
  97. * The node-related operation: 'node', 'form', 'comment'.
  98. */
  99. function hook_context_node_condition_alter(&$node, $op) {
  100. if ($plugin = context_get_plugin('condition', 'bar')) {
  101. $plugin->execute($node, $op);
  102. }
  103. }
  104. /**
  105. * Alter a context directly after it has been loaded. Allows modules to alter
  106. * a context object's reactions. While you may alter conditions, this will
  107. * generally have no effect as conditions are cached for performance and
  108. * contexts are loaded after conditions are checked, not before.
  109. *
  110. * @param &$context
  111. * The context object by reference.
  112. */
  113. function hook_context_load_alter(&$context) {
  114. if ($context->name === 'foo' && isset($context->reactions['block'])) {
  115. $context->reactions['block']['blocks']['locale-0'] = array(
  116. 'module' => 'locale',
  117. 'delta' => '0',
  118. 'region' => 'header',
  119. 'weight' => '2',
  120. );
  121. }
  122. }
  123. /**
  124. * Allows for finer grained access mechanisms to using the json
  125. * rendering capabilities of the block reaction when a user isn't
  126. * granted the administer contexts or context ajax block access
  127. * permission
  128. * @param $block_id
  129. * ID of block in module-delta format
  130. */
  131. function hook_context_allow_ajax_block_access($block_id) {
  132. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.