function views_handler_argument::options_validate

Same name in other branches
  1. 6.x-3.x handlers/views_handler_argument.inc \views_handler_argument::options_validate()

Overrides views_handler::options_validate

File

handlers/views_handler_argument.inc, line 454

Class

views_handler_argument
Base class for arguments.

Code

public function options_validate(&$form, &$form_state) {
    if (empty($form_state['values']['options'])) {
        return;
    }
    // Let the plugins do validation.
    $default_id = $form_state['values']['options']['default_argument_type'];
    $plugin = $this->get_plugin('argument default', $default_id);
    if ($plugin && isset($form['argument_default'][$default_id]) && isset($form_state['values']['options']['argument_default'][$default_id])) {
        $plugin->options_validate($form['argument_default'][$default_id], $form_state, $form_state['values']['options']['argument_default'][$default_id]);
    }
    // Validate summary plugin options if one is present.
    if (isset($form_state['values']['options']['summary']['format'])) {
        $summary_id = $form_state['values']['options']['summary']['format'];
        $plugin = $this->get_plugin('style', $summary_id);
        if ($plugin) {
            $plugin->options_validate($form['summary']['options'][$summary_id], $form_state, $form_state['values']['options']['summary']['options'][$summary_id]);
        }
    }
    $validate_id = $form_state['values']['options']['validate']['type'];
    $plugin = $this->get_plugin('argument validator', $validate_id);
    if ($plugin) {
        $plugin->options_validate($form['validate']['options'][$default_id], $form_state, $form_state['values']['options']['validate']['options'][$validate_id]);
    }
}