context_load

6 context.module context_load($name = NULL, $reset = FALSE)
7 context.module context_load($name = NULL, $reset = FALSE)

Context loader.

Parameters

$name: The name for this context object.

Return value

Returns a fully-loaded context definition.

17 functions call context_load()

File

contributions/context/context.module, line 191

Code

<?php
function context_load($name = NULL, $reset = FALSE) {
  ctools_include('export');
  static $contexts;
  static $altered;
  if (!isset($contexts) || $reset) {
    $contexts = $altered = array();
    if (!$reset && $contexts = context_cache_get('context')) {
      // Nothing here.
    }
    else {
      if ($reset) {
        ctools_export_load_object_reset('context');
      }
      $contexts = ctools_export_load_object('context', 'all');
      context_cache_set('context', $contexts);
    }
  }
  if (isset($name)) {
    // Allow other modules to alter the value just before it's returned.
    if (isset($contexts[$name]) && !isset($altered[$name])) {
      $altered[$name] = TRUE;
      drupal_alter('context_load', $contexts[$name]);
    }
    return isset($contexts[$name]) ? $contexts[$name] : FALSE;
  }
  return $contexts;
}
?>