You are here

function _variable_realm_invoke_all in Variable 7.2

Invoke variable realm hook on all currently loaded modules.

Variable realm usually starts from bootstrap, on hook_boot() and from here it is not safe to user regular hook invokation so we use our own function, similar to bootstrap_invoke_all() but returning the values (with deep merge).

@pram $hook Hook to invoke in all loaded modules

Parameters

$arg1, $arg2...: A variable number of arguments.

See also

boostrap_invoke_all()

module_invoke()

4 calls to _variable_realm_invoke_all()
variable_realm_info in variable_realm/variable_realm.module
Get information about variable realms.
variable_realm_initialize in variable_realm/variable_realm.module
Initialize realm and set key depending on request.
variable_realm_rebuild in variable_realm/variable_realm.module
Rebuild current variable realm.
variable_realm_switch in variable_realm/variable_realm.module
Switch current variable realms.

File

variable_realm/variable_realm.module, line 596
Variable API module - Realms

Code

function _variable_realm_invoke_all() {
  $args = func_get_args();
  $hook = array_shift($args);
  $result = array();
  foreach (module_list() as $module) {
    if (module_hook($module, $hook) && ($merge = call_user_func_array($module . '_' . $hook, $args))) {
      $result = drupal_array_merge_deep($result, $merge);

      // Add module name to each of the realms provided by the module.
      foreach (array_keys($merge) as $key) {
        $result[$key] += array(
          'module' => $module,
        );
      }
      unset($merge);
    }
  }
  return $result;
}