API.txt

  1. cis7 sites/all/modules/ulmus/pathauto/API.txt
  2. cis7 sites/all/modules/ulmus/security_review/API.txt
  3. cis7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  4. cis7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  5. cis7 sites/all/modules/ulmus/ctools/API.txt
  6. cis7 sites/all/modules/ulmus/context/API.txt
  7. cis7 sites/all/modules/ulmus/aes/API.txt
  8. cis7 sites/all/modules/ulmus/media/API.txt
  9. cis7 sites/all/modules/ulmus/features/API.txt
  10. cle7 sites/all/modules/ulmus/security_review/API.txt
  11. cle7 sites/all/modules/ulmus/features/API.txt
  12. cle7 sites/all/modules/ulmus/media/API.txt
  13. cle7 sites/all/modules/ulmus/pathauto/API.txt
  14. cle7 sites/all/modules/ulmus/context/API.txt
  15. cle7 sites/all/modules/ulmus/ctools/API.txt
  16. cle7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  17. cle7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  18. cle7 sites/all/modules/ulmus/aes/API.txt
  19. cle7 sites/all/modules/local_contrib/votingapi/API.txt
  20. ecd7 sites/all/modules/ulmus/aes/API.txt
  21. ecd7 sites/all/modules/ulmus/ctools/API.txt
  22. ecd7 sites/all/modules/ulmus/security_review/API.txt
  23. ecd7 sites/all/modules/ulmus/context/API.txt
  24. ecd7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  25. ecd7 sites/all/modules/ulmus/media/API.txt
  26. ecd7 sites/all/modules/ulmus/features/API.txt
  27. ecd7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  28. ecd7 sites/all/modules/ulmus/pathauto/API.txt
  29. elmsmedia7 sites/all/modules/ulmus/security_review/API.txt
  30. elmsmedia7 sites/all/modules/ulmus/aes/API.txt
  31. elmsmedia7 sites/all/modules/ulmus/features/API.txt
  32. elmsmedia7 sites/all/modules/ulmus/ctools/API.txt
  33. elmsmedia7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  34. elmsmedia7 sites/all/modules/ulmus/media/API.txt
  35. elmsmedia7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  36. elmsmedia7 sites/all/modules/ulmus/pathauto/API.txt
  37. elmsmedia7 sites/all/modules/ulmus/context/API.txt
  38. harmony7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  39. harmony7 sites/all/modules/ulmus/features/API.txt
  40. harmony7 sites/all/modules/ulmus/context/API.txt
  41. harmony7 sites/all/modules/ulmus/media/API.txt
  42. harmony7 sites/all/modules/ulmus/pathauto/API.txt
  43. harmony7 sites/all/modules/ulmus/ctools/API.txt
  44. harmony7 sites/all/modules/ulmus/aes/API.txt
  45. harmony7 sites/all/modules/ulmus/security_review/API.txt
  46. harmony7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  47. icor7 sites/all/modules/ulmus/security_review/API.txt
  48. icor7 sites/all/modules/ulmus/context/API.txt
  49. icor7 sites/all/modules/ulmus/pathauto/API.txt
  50. icor7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  51. icor7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  52. icor7 sites/all/modules/ulmus/ctools/API.txt
  53. icor7 sites/all/modules/ulmus/features/API.txt
  54. icor7 sites/all/modules/ulmus/media/API.txt
  55. icor7 sites/all/modules/ulmus/aes/API.txt
  56. meedjum_blog7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  57. meedjum_blog7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
  58. meedjum_blog7 sites/all/modules/ulmus/aes/API.txt
  59. meedjum_blog7 sites/all/modules/ulmus/security_review/API.txt
  60. meedjum_blog7 sites/all/modules/ulmus/ctools/API.txt
  61. meedjum_blog7 sites/all/modules/ulmus/context/API.txt
  62. meedjum_blog7 sites/all/modules/ulmus/pathauto/API.txt
  63. meedjum_blog7 sites/all/modules/ulmus/media/API.txt
  64. meedjum_blog7 sites/all/modules/ulmus/features/API.txt
  65. mooc7 sites/all/modules/ulmus/aes/API.txt
  66. mooc7 sites/all/modules/ulmus/ctools/API.txt
  67. mooc7 sites/all/modules/elmsln_contrib/outline_designer/API.txt
  68. mooc7 sites/all/modules/ulmus/security_review/API.txt
  69. mooc7 sites/all/modules/ulmus/context/API.txt
  70. mooc7 sites/all/modules/ulmus/pathauto/API.txt
  71. mooc7 sites/all/modules/ulmus/media/API.txt
  72. mooc7 sites/all/modules/ulmus/features/API.txt
  73. mooc7 sites/all/modules/elmsln_contrib/nodereference_highlight/API.txt
Context 3.x API
---------------
The following is an overview of using the Context API.


The context static cache
------------------------
Context provides a centralized set of API functions for setting and retrieving a
static cache:

    // Set a static cache value at [my_namspace][mykey]
    context_set('my_namespace', 'mykey', $value);

    // Retrieve a static cache value at [my_namespace][mykey]
    context_get('my_namespace', 'mykey'); // $value

    // Boolean for whether there is a value at [my_namespace][mykey]
    context_isset('my_namespace', 'mykey'); // TRUE

These are used internally by context but may also be used by other modules. Just
do not use the namespace `context` unless you want to affect things that context
is up to.


Adding a condition or reaction plugin
-------------------------------------
Both context conditions and reactions utilize the CTools plugins API. In order
to add a new condition or reaction for your module, follow these steps:

1. Implement `hook_context_plugins()` to define your plugins, classes, and class
  hierarchy.

        function mymodule_context_plugins() {
          $plugins = array();
          $plugins['mymodule_context_condition_bar'] = array(
            'handler' => array(
              'path' => drupal_get_path('module', 'mymodule') .'/plugins',
              'file' => 'mymodule_context_condition_bar.inc',
              'class' => 'mymodule_context_condition_bar',
              'parent' => 'context_condition',
            ),
          );
          return $plugins;
        }

2. Implement `hook_context_registry()` to define your conditions and/or
  reactions and map them to plugins.

        function mymodule_context_registry() {
          return array(
            'conditions' => array(
              'bar' => array(
                'title' => t('Name of condition "bar"'),
                'plugin' => 'mymodule_context_condition_bar',
              ),
            ),
          );
        }

3. Write your condition or reaction plugin class. It's best to look at one of
  the included plugins as a starting point.

4. Create a Drupal integration point for your plugin. A node page condition
  plugin, for example, may be invoked from `hook_node_view()`. Typically a
  Drupal integration point for a condition uses a Drupal hook to trigger
  tests that determine whether context conditions are met for one or more
  plug-ins. For example, this is how the context module itself uses
  hook_init():

        function context_init() {
          if ($plugin = context_get_plugin('condition', 'path')) {
            $plugin->execute();
          }
          if ($plugin = context_get_plugin('condition', 'language')) {
            global $language;
            $plugin->execute($language->language);
          }
          if ($plugin = context_get_plugin('condition', 'user')) {
            global $user;
            $plugin->execute($user);
          }
        }

  This function first instantiates the Context module's path condition
  plugin (filename context_condition_path.inc in the plugins directory),
  and then uses that plugin's execute() method. The execute() method
  determine whether any path conditions are met and, if so, it activates
  the contexts that match those conditions. After setting contexts based
  path conditions, the context_init() function then does the same thing
  with the Context module's language and user condition plugins.

Replacing or extending existing plugins
---------------------------------------
You can replace a condition or reaction plugin with your own plugin class using
`hook_context_registry_alter()`:

    function mymodule_context_registry_alter(&$registry) {
      if (!empty($registry['conditions']['node'])) {
        $registry['conditions']['node']['plugin'] = 'mymodule_context_condition_customnode';
      }
    }

This entry would swap out the default node condition plugin for a custom one
provided by `mymodule`. Note that any replacement plugins must have an entry in
`hook_context_plugins()`.

File

sites/all/modules/ulmus/context/API.txt
View source
  1. Context 3.x API
  2. ---------------
  3. The following is an overview of using the Context API.
  4. The context static cache
  5. ------------------------
  6. Context provides a centralized set of API functions for setting and retrieving a
  7. static cache:
  8. // Set a static cache value at [my_namspace][mykey]
  9. context_set('my_namespace', 'mykey', $value);
  10. // Retrieve a static cache value at [my_namespace][mykey]
  11. context_get('my_namespace', 'mykey'); // $value
  12. // Boolean for whether there is a value at [my_namespace][mykey]
  13. context_isset('my_namespace', 'mykey'); // TRUE
  14. These are used internally by context but may also be used by other modules. Just
  15. do not use the namespace `context` unless you want to affect things that context
  16. is up to.
  17. Adding a condition or reaction plugin
  18. -------------------------------------
  19. Both context conditions and reactions utilize the CTools plugins API. In order
  20. to add a new condition or reaction for your module, follow these steps:
  21. 1. Implement `hook_context_plugins()` to define your plugins, classes, and class
  22. hierarchy.
  23. function mymodule_context_plugins() {
  24. $plugins = array();
  25. $plugins['mymodule_context_condition_bar'] = array(
  26. 'handler' => array(
  27. 'path' => drupal_get_path('module', 'mymodule') .'/plugins',
  28. 'file' => 'mymodule_context_condition_bar.inc',
  29. 'class' => 'mymodule_context_condition_bar',
  30. 'parent' => 'context_condition',
  31. ),
  32. );
  33. return $plugins;
  34. }
  35. 2. Implement `hook_context_registry()` to define your conditions and/or
  36. reactions and map them to plugins.
  37. function mymodule_context_registry() {
  38. return array(
  39. 'conditions' => array(
  40. 'bar' => array(
  41. 'title' => t('Name of condition "bar"'),
  42. 'plugin' => 'mymodule_context_condition_bar',
  43. ),
  44. ),
  45. );
  46. }
  47. 3. Write your condition or reaction plugin class. It's best to look at one of
  48. the included plugins as a starting point.
  49. 4. Create a Drupal integration point for your plugin. A node page condition
  50. plugin, for example, may be invoked from `hook_node_view()`. Typically a
  51. Drupal integration point for a condition uses a Drupal hook to trigger
  52. tests that determine whether context conditions are met for one or more
  53. plug-ins. For example, this is how the context module itself uses
  54. hook_init():
  55. function context_init() {
  56. if ($plugin = context_get_plugin('condition', 'path')) {
  57. $plugin->execute();
  58. }
  59. if ($plugin = context_get_plugin('condition', 'language')) {
  60. global $language;
  61. $plugin->execute($language->language);
  62. }
  63. if ($plugin = context_get_plugin('condition', 'user')) {
  64. global $user;
  65. $plugin->execute($user);
  66. }
  67. }
  68. This function first instantiates the Context module's path condition
  69. plugin (filename context_condition_path.inc in the plugins directory),
  70. and then uses that plugin's execute() method. The execute() method
  71. determine whether any path conditions are met and, if so, it activates
  72. the contexts that match those conditions. After setting contexts based
  73. path conditions, the context_init() function then does the same thing
  74. with the Context module's language and user condition plugins.
  75. Replacing or extending existing plugins
  76. ---------------------------------------
  77. You can replace a condition or reaction plugin with your own plugin class using
  78. `hook_context_registry_alter()`:
  79. function mymodule_context_registry_alter(&$registry) {
  80. if (!empty($registry['conditions']['node'])) {
  81. $registry['conditions']['node']['plugin'] = 'mymodule_context_condition_customnode';
  82. }
  83. }
  84. This entry would swap out the default node condition plugin for a custom one
  85. provided by `mymodule`. Note that any replacement plugins must have an entry in
  86. `hook_context_plugins()`.
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.