Same name and namespace in other branches
  1. 6.x-3.x includes/base.inc \views_object::export_option()
3 calls to views_object::export_option()
views_object::export_options in includes/base.inc
views_object::export_option_always in includes/base.inc
Always exports the option, regardless of the default value.
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 259
Definition of views_object.

Class

views_object

Code

public 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;
}