function variable_get_child in Variable 7.2
Same name and namespace in other branches
- 7 variable.module \variable_get_child()
Get variable child element from multiple variable
Parameters
$parent: Parent variable
$key: Key of the children variable (not the full name, just the piece of string that makes the difference)
Related topics
1 call to variable_get_child()
- node_variable_type_subform in includes/
node.variable.inc - Build subform for variables for node type
File
- ./
variable.module, line 135 - Variable API module
Code
function variable_get_child($parent, $key, $options = array()) {
$variable = variable_build($parent, $options);
$name = preg_replace('/\\[\\w+\\]/', $key, $variable['name']);
$child = $variable['children'][$name];
// Replace title and description
foreach (array(
'title',
'description',
) as $property) {
if (isset($variable[$property])) {
$child[$property] = $variable[$property];
}
}
return $child;
}