function views_handler_argument::init

Overrides views_handler::init

3 calls to views_handler_argument::init()
views_handler_argument_field_list::init in modules/field/views_handler_argument_field_list.inc
Init the handler with necessary data.
views_handler_argument_many_to_one::init in handlers/views_handler_argument_many_to_one.inc
Init the handler with necessary data.
views_handler_argument_string::init in handlers/views_handler_argument_string.inc
Init the handler with necessary data.
3 methods override views_handler_argument::init()
views_handler_argument_field_list::init in modules/field/views_handler_argument_field_list.inc
Init the handler with necessary data.
views_handler_argument_many_to_one::init in handlers/views_handler_argument_many_to_one.inc
Init the handler with necessary data.
views_handler_argument_string::init in handlers/views_handler_argument_string.inc
Init the handler with necessary data.

File

handlers/views_handler_argument.inc, line 88

Class

views_handler_argument
Base class for arguments.

Code

public function init(&$view, &$options) {
    parent::init($view, $options);
    // Compatibility: The new UI changed several settings.
    if (!empty($options['wildcard']) && !isset($options['exception']['value'])) {
        $this->options['exception']['value'] = $options['wildcard'];
    }
    if (!empty($options['wildcard_substitution']) && !isset($options['exception']['title'])) {
        // Enable the checkbox if the title is filled in.
        $this->options['exception']['title_enable'] = 1;
        $this->options['exception']['title'] = $options['wildcard_substitution'];
    }
    if (!isset($options['summary']['format']) && !empty($options['style_plugin'])) {
        $this->options['summary']['format'] = $options['style_plugin'];
    }
    // Setup default value.
    $options['style_options'] = isset($options['style_options']) ? $options['style_options'] : array();
    if (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary asc') {
        $this->options['default_action'] = 'summary';
        $this->options['summary']['sort_order'] = 'asc';
        $this->options['summary']['number_of_records'] = 0;
        $this->options['summary_options'] = $options['style_options'];
    }
    elseif (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary desc') {
        $this->options['default_action'] = 'summary';
        $this->options['summary']['sort_order'] = 'desc';
        $this->options['summary']['number_of_records'] = 0;
        $this->options['summary_options'] = $options['style_options'];
    }
    elseif (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary asc by count') {
        $this->options['default_action'] = 'summary';
        $this->options['summary']['sort_order'] = 'asc';
        $this->options['summary']['number_of_records'] = 1;
        $this->options['summary_options'] = $options['style_options'];
    }
    elseif (!isset($options['summary']['sort_order']) && !empty($options['default_action']) && $options['default_action'] == 'summary desc by count') {
        $this->options['default_action'] = 'summary';
        $this->options['summary']['sort_order'] = 'desc';
        $this->options['summary']['number_of_records'] = 1;
        $this->options['summary_options'] = $options['style_options'];
    }
    if (!empty($options['title']) && !isset($options['title_enable'])) {
        $this->options['title_enable'] = 1;
    }
    if (!empty($options['breadcrumb']) && !isset($options['breadcrumb_enable'])) {
        $this->options['breadcrumb_enable'] = 1;
    }
    if (!empty($options['validate_type']) && !isset($options['validate']['type'])) {
        $this->options['validate']['type'] = $options['validate_type'];
        $this->options['specify_validation'] = 1;
    }
    if (!empty($options['validate_fail']) && !isset($options['validate']['fail'])) {
        $this->options['validate']['fail'] = $options['validate_fail'];
        $this->options['specify_validation'] = 1;
    }
}