function context_var_export in Context 6
Same name and namespace in other branches
- 6.2 context.module \context_var_export()
Export a variable.
2 calls to context_var_export()
- context_ui_bulk_export in context_ui/
context_ui.admin.inc - Export multiple contexts
- theme_context_ui_export_form in context_ui/
context_ui.admin.inc - Themes a context value into an export friendly var_export().
File
- ./
context.module, line 648
Code
function context_var_export($var, $prefix = '', $multiple = TRUE) {
if (is_array($var)) {
if (empty($var)) {
$output = 'array()';
}
else {
$output = "array(\n";
foreach ($var as $key => $value) {
$output .= " '{$key}' => " . context_var_export($value, $prefix . ($multiple ? '' : ' ')) . ",\n";
}
$output .= ')';
}
}
else {
if (is_bool($var)) {
$output = $var ? 'TRUE' : 'FALSE';
}
else {
$output = var_export($var, TRUE);
}
}
if ($prefix) {
$output = str_replace("\n", "\n{$prefix}", $output);
}
return $output;
}