You are here

public function views_handler_argument::export_validation in Views (for Drupal 7) 7.3

Export handler for validation export.

Arguments use validation plugins. This special export handler makes sure this works properly.

Return value

string The validation response.

File

handlers/views_handler_argument.inc, line 1209
Definition of views_handler_argument.

Class

views_handler_argument
Base class for arguments.

Code

public function export_validation($indent, $prefix, $storage, $option, $definition, $parents) {
  $output = '';
  $name = $this->options['validate'][$option];
  $options = $this->options['validate_options'];
  $plugin = views_get_plugin('argument validator', $name);
  if ($plugin) {
    $plugin
      ->init($this->view, $this->display, $options);

    // Write which plugin to use.
    $output .= $indent . $prefix . "['validate']['{$option}'] = '{$name}';\n";

    // Pass off to the plugin to export itself.
    $output .= $plugin
      ->export_options($indent, $prefix . "['validate_options']");
  }
  return $output;
}