You are here

function variable_children in Variable 7.2

Same name and namespace in other branches
  1. 7 variable.module \variable_children()

Get list of variables expanding multiple ones

Parameters

$names: List of variable names or full variable arrays

Return value

array() List variable names with spawned multiple variables

Related topics

7 calls to variable_children()
variable_module_enable in ./variable.inc
Disable variables for module
variable_parent in ./variable.module
Map children variables to parent variables
variable_realm_form_system_theme_settings_alter in variable_realm/variable_realm.module
Implements hook_form_FORM_ID_alter()
variable_realm_select_variables_form_submit in variable_realm/variable_realm.form.inc
Select variables for realm.
variable_realm_variable_delete in variable_realm/variable_realm.module
Implements hook_variable_delete().

... See full list

File

./variable.module, line 71
Variable API module

Code

function variable_children($names) {
  $names = is_array($names) ? $names : array(
    $names,
  );
  $list = array();
  foreach ($names as $name) {

    // We need to build the variable, it may be multiple
    $variable = variable_build($name);
    if (!empty($variable['children'])) {
      $list = array_merge($list, array_keys($variable['children']));
    }
    else {
      $list[] = $variable['name'];
    }
  }
  return $list;
}