You are here

function variable_children in Variable 7

Same name and namespace in other branches
  1. 7.2 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

5 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_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().
_variable_views_variable_list in variable_views/variable_views.module
Variable list for the argument.

File

./variable.module, line 69
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;
}