You are here

function variable_invoke_all in Variable 7

Same name and namespace in other branches
  1. 7.2 variable.module \variable_invoke_all()

Invoke hook on all modules, adding 'module' property

1 call to variable_invoke_all()
variable_build_info in ./variable.inc
Build generic variable information

File

./variable.inc, line 59
Variable API module. Extended API.

Code

function variable_invoke_all() {
  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  $return = array();
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
      $result = call_user_func_array($function, $args);
      if (isset($result) && is_array($result)) {
        foreach ($result as $key => $value) {
          $return[$key] = $value + array(
            'module' => $module,
          );
        }
      }
    }
  }
  return $return;
}