You are here

function context_prefix_providers in Context 5

Invokes hook_context_prefix_provider() to gather all providers.

Modules that implement hook_context_prefix_provider need to return an array of prefix definitions. Each definition should have the following keys:

  • name
  • description
  • callback
  • example

See the spaces module for an usage example.

2 calls to context_prefix_providers()
context_prefix_settings_form in context_prefix/context_prefix.module
Settings form for choosing the operating mode of context_prefix
_context_prefix_set in context_prefix/context_prefix.module
Static cache function for setting + storing any prefixed contexts that are present on this page's request.

File

context_prefix/context_prefix.module, line 306

Code

function context_prefix_providers($by_method = FALSE) {
  static $providers;
  if (!is_array($providers)) {
    $providers = array();
    $providers = module_invoke_all('context_prefix_provider');
  }
  if ($by_method) {
    static $methods;
    if (!isset($methods)) {
      $methods = new context_prefix_cache();
      foreach ($providers as $id => $provider) {
        $methods
          ->add(variable_get('context_prefix_method_' . $id, CONTEXT_PREFIX_PATH), array(
          $id => $provider,
        ));
      }
    }
    return $methods
      ->get();
  }
  else {
    return $providers;
  }
}