function system_patterns_export_all_variables in Patterns 7.2
Same name and namespace in other branches
- 7 patterns_components/components/system.inc \system_patterns_export_all_variables()
Returns a set of PATTERNS_MODIFY actions with the whole set of variables currently stored in the system.
Parameters
string $args:
string $result:
Return value
array $actions
1 string reference to 'system_patterns_export_all_variables'
- system_patterns in patterns_components/
components/ system.inc - Implements hook_patterns().
File
- patterns_components/
components/ system.inc, line 121
Code
function system_patterns_export_all_variables($args = NULL, &$result = NULL) {
//Get all the currently stored variables
$query = db_select('variable', 'v')
->extend('TableSort');
$query
->fields('v', array(
'name',
'value',
));
$qresult = $query
->execute();
//Got through all the variables and prepare set of CREATE or MODIFY actions
$actions = array(
PATTERNS_MODIFY => array(
'tag' => 'variables',
),
);
foreach ($qresult as $row) {
$name = $row->name;
$value = variable_get($name);
//Apply htmlspecialchars() function recursively to keep the same value input by the user
_htmlspecialchars_decode($value);
$action = array(
'name' => $name,
'value' => $value,
);
array_push($actions[PATTERNS_MODIFY], $action);
}
$result = array(
$actions,
);
return $result;
}