You are here

function variable_get_info in Variable 7

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

Get variable information

Variable information is collected from modules and cached by language

Parameters

$name: Optional variable name. Will return all if no name.

$options array: Options for variable values

  • 'langcode', Language code

Related topics

11 calls to variable_get_info()
VariableTestCase::testVariableAPI in ./variable.test
Test that all core modules can be enabled, disabled and uninstalled.
variable_edit_subform in ./variable.module
Form elements for variable list.
variable_list_group in ./variable.inc
List variables for a group
variable_list_module in ./variable.inc
List variables for a module
variable_parent in ./variable.module
Map children variables to parent variables

... See full list

File

./variable.module, line 157
Variable API module

Code

function variable_get_info($name = NULL, $options = array()) {
  $options = _variable_options($options);
  if (!$name) {
    return _variable_info('variable', NULL, $options);
  }
  elseif ($info = _variable_info('variable', $name, $options)) {
    return $info;
  }
  elseif ($parent = variable_parent($name)) {
    $info = variable_build(variable_get_info($parent));
    $child = $info['children'][$name];

    // Copy over some values from parent to child to add some context to it.
    $child['title'] = $info['title'] . ' [' . $child['title'] . ']';
    if (isset($info['description'])) {
      $child['description'] = $info['description'];
    }
    return $child;
  }
  else {
    return NULL;
  }
}