function views_handler_argument::options_form
Overrides views_handler::options_form
6 calls to views_handler_argument::options_form()
- views_handler_argument_many_to_one::options_form in handlers/
views_handler_argument_many_to_one.inc - Build the options form.
- views_handler_argument_null::options_form in handlers/
views_handler_argument_null.inc - Override options_form() so that only the relevant options are displayed to the user.
- views_handler_argument_numeric::options_form in handlers/
views_handler_argument_numeric.inc - Build the options form.
- views_handler_argument_string::options_form in handlers/
views_handler_argument_string.inc - Build the options form.
- views_handler_argument_term_node_tid_depth::options_form in modules/
taxonomy/ views_handler_argument_term_node_tid_depth.inc - Build the options form.
8 methods override views_handler_argument::options_form()
- views_handler_argument_broken::options_form in handlers/
views_handler_argument.inc - Build the options form.
- views_handler_argument_many_to_one::options_form in handlers/
views_handler_argument_many_to_one.inc - Build the options form.
- views_handler_argument_null::options_form in handlers/
views_handler_argument_null.inc - Override options_form() so that only the relevant options are displayed to the user.
- views_handler_argument_numeric::options_form in handlers/
views_handler_argument_numeric.inc - Build the options form.
- views_handler_argument_string::options_form in handlers/
views_handler_argument_string.inc - Build the options form.
File
-
handlers/
views_handler_argument.inc, line 252
Class
- views_handler_argument
- Base class for arguments.
Code
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$argument_text = $this->view->display_handler
->get_argument_text();
$form['#pre_render'][] = 'views_ui_pre_render_move_argument_options';
$form['description'] = array(
'#markup' => $argument_text['description'],
'#theme_wrappers' => array(
'container',
),
'#attributes' => array(
'class' => array(
'description',
),
),
);
$form['no_argument'] = array(
'#type' => 'fieldset',
'#title' => $argument_text['filter value not present'],
);
// Everything in the fieldset is floated, so the last element needs to
// clear those floats.
$form['no_argument']['clearfix'] = array(
'#weight' => 1000,
'#markup' => '<div class="clearfix"></div>',
);
$form['default_action'] = array(
'#type' => 'radios',
'#process' => array(
'views_ui_process_container_radios',
),
'#default_value' => $this->options['default_action'],
'#fieldset' => 'no_argument',
);
$form['exception'] = array(
'#type' => 'fieldset',
'#title' => t('Exceptions'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#fieldset' => 'no_argument',
);
$form['exception']['value'] = array(
'#type' => 'textfield',
'#title' => t('Exception value'),
'#size' => 20,
'#default_value' => $this->options['exception']['value'],
'#description' => t('If this value is received, the filter will be ignored; i.e, "all values". This will bypass any validation criterion provided below.'),
);
$form['exception']['title_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Override title'),
'#default_value' => $this->options['exception']['title_enable'],
);
$form['exception']['title'] = array(
'#type' => 'textfield',
'#title' => t('Override title'),
'#title_display' => 'invisible',
'#size' => 20,
'#default_value' => $this->options['exception']['title'],
'#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'),
'#dependency' => array(
'edit-options-exception-title-enable' => array(
'1',
),
),
);
$options = array();
$defaults = $this->default_actions();
$validate_options = array();
foreach ($defaults as $id => $info) {
$options[$id] = $info['title'];
if (empty($info['default only'])) {
$validate_options[$id] = $info['title'];
}
if (!empty($info['form method'])) {
$this->{$info['form method']}($form, $form_state);
}
}
$form['default_action']['#options'] = $options;
$form['argument_present'] = array(
'#type' => 'fieldset',
'#title' => $argument_text['filter value present'],
);
$form['title_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Override title'),
'#default_value' => $this->options['title_enable'],
'#fieldset' => 'argument_present',
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Provide title'),
'#title_display' => 'invisible',
'#default_value' => $this->options['title'],
'#description' => t('Override the view and other argument titles. Use "%1" for the first argument, "%2" for the second, etc.'),
'#dependency' => array(
'edit-options-title-enable' => array(
'1',
),
),
'#fieldset' => 'argument_present',
);
$form['breadcrumb_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Override breadcrumb'),
'#default_value' => $this->options['breadcrumb_enable'],
'#fieldset' => 'argument_present',
);
$form['breadcrumb'] = array(
'#type' => 'textfield',
'#title' => t('Provide breadcrumb'),
'#title_display' => 'invisible',
'#default_value' => $this->options['breadcrumb'],
'#description' => t('Enter a breadcrumb name you would like to use. See "Title" for percent substitutions.'),
'#dependency' => array(
'edit-options-breadcrumb-enable' => array(
'1',
),
),
'#fieldset' => 'argument_present',
);
$form['specify_validation'] = array(
'#type' => 'checkbox',
'#title' => t('Specify validation criteria'),
'#default_value' => $this->options['specify_validation'],
'#fieldset' => 'argument_present',
);
$form['validate'] = array(
'#type' => 'container',
'#fieldset' => 'argument_present',
);
// @todo The mockup wanted to use "Validate using" here, but it doesn't
// work well with many options (they'd need to be changed as well)
$form['validate']['type'] = array(
'#type' => 'select',
'#title' => t('Validator'),
'#default_value' => $this->options['validate']['type'],
'#dependency' => array(
'edit-options-specify-validation' => array(
'1',
),
),
);
$validate_types = array(
'none' => t('- Basic validation -'),
);
$plugins = views_fetch_plugin_data('argument validator');
foreach ($plugins as $id => $info) {
if (!empty($info['no ui'])) {
continue;
}
$valid = TRUE;
if (!empty($info['type'])) {
$valid = FALSE;
if (empty($this->definition['validate type'])) {
continue;
}
foreach ((array) $info['type'] as $type) {
if ($type == $this->definition['validate type']) {
$valid = TRUE;
break;
}
}
}
// If we decide this validator is ok, add it to the list.
if ($valid) {
$plugin = $this->get_plugin('argument validator', $id);
if ($plugin) {
if ($plugin->access() || $this->options['validate']['type'] == $id) {
$form['validate']['options'][$id] = array(
'#prefix' => '<div id="edit-options-validate-options-' . $id . '-wrapper">',
'#suffix' => '</div>',
'#type' => 'item',
// Even if the plugin has no options, add the key to the
// form_state. Trick it into checking input to make #process run.
'#input' => TRUE,
'#dependency' => array(
'edit-options-specify-validation' => array(
'1',
),
'edit-options-validate-type' => array(
$id,
),
),
'#dependency_count' => 2,
'#id' => 'edit-options-validate-options-' . $id,
);
$plugin->options_form($form['validate']['options'][$id], $form_state);
$validate_types[$id] = $info['title'];
}
}
}
}
asort($validate_types);
$form['validate']['type']['#options'] = $validate_types;
$form['validate']['fail'] = array(
'#type' => 'select',
'#title' => t('Action to take if filter value does not validate'),
'#default_value' => $this->options['validate']['fail'],
'#options' => $validate_options,
'#dependency' => array(
'edit-options-specify-validation' => array(
'1',
),
),
'#fieldset' => 'argument_present',
);
}