You are here

function variable_callback in Variable 7

Same name and namespace in other branches
  1. 7.2 variable.inc \variable_callback()

Invoke variable callback

Parameters

$callback: Function name to invoke or array with module and funcion in this order

$variable: Array of variable information.

$options: Options to pass to the callback

$module: Optional module to include its '*.variable.inc' file if the function not found

6 calls to variable_callback()
variable_build_multiple in ./variable.inc
Build multiple variables
variable_build_options in ./variable.inc
Build variable with options
variable_build_variable in ./variable.inc
Build single variable
variable_format_value in ./variable.module
Format printable value
variable_get_value in ./variable.module
Get value for simple scalar variable

... See full list

File

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

Code

function variable_callback($callback, $variable, $options = array()) {
  if (is_array($callback)) {
    list($module, $function) = $callback;
  }
  else {
    $function = $callback;
  }
  if (!function_exists($function)) {
    if (isset($module)) {
      variable_module_include($module);
    }
    else {
      variable_include($variable);
    }
  }
  return call_user_func($function, $variable, $options);
}