function views_object::export_option
Same name in other branches
- 7.x-3.x includes/base.inc \views_object::export_option()
2 calls to views_object::export_option()
- views_object::export_options in includes/
base.inc - views_plugin_display::export_option in plugins/
views_plugin_display.inc - Override of export_option()
1 method overrides views_object::export_option()
- views_plugin_display::export_option in plugins/
views_plugin_display.inc - Override of export_option()
File
-
includes/
base.inc, line 203
Class
- views_object
- Basic definition for many views objects
Code
function export_option($indent, $prefix, $storage, $option, $definition, $parents) {
// Do not export options for which we have no settings.
if (!isset($storage[$option])) {
return;
}
if (isset($definition['export'])) {
if ($definition['export'] === FALSE) {
return;
}
// Special handling for some items
if (method_exists($this, $definition['export'])) {
return $this->{$definition['export']}($indent, $prefix, $storage, $option, $definition, $parents);
}
}
// Add the current option to the parents tree.
$parents[] = $option;
$output = '';
// If it has child items, export those separately.
if (isset($definition['contains'])) {
foreach ($definition['contains'] as $sub_option => $sub_definition) {
$output .= $this->export_option($indent, $prefix, $storage[$option], $sub_option, $sub_definition, $parents);
}
}
else {
$default = isset($definition['default']) ? $definition['default'] : NULL;
$value = $storage[$option];
if (isset($definition['bool'])) {
$value = (bool) $value;
}
if ($value !== $default) {
$output .= $indent . $prefix . "['" . implode("']['", $parents) . "'] = ";
if (isset($definition['bool'])) {
$output .= empty($storage[$option]) ? 'FALSE' : 'TRUE';
}
else {
$output .= views_var_export($storage[$option], $indent);
}
$output .= ";\n";
}
}
return $output;
}