public function ArgumentPluginBase::buildOptionsForm in Views (for Drupal 7) 8.3
Build the options form.
Overrides HandlerBase::buildOptionsForm
5 calls to ArgumentPluginBase::buildOptionsForm()
- IndexTidDepth::buildOptionsForm in lib/
Views/ taxonomy/ Plugin/ views/ argument/ IndexTidDepth.php - Build the options form.
- ManyToOne::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ ManyToOne.php - Build the options form.
- Null::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ Null.php - Override buildOptionsForm() so that only the relevant options are displayed to the user.
- Numeric::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ Numeric.php - Build the options form.
- String::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ String.php - Build the options form.
7 methods override ArgumentPluginBase::buildOptionsForm()
- Broken::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ Broken.php - Build the options form.
- IndexTidDepth::buildOptionsForm in lib/
Views/ taxonomy/ Plugin/ views/ argument/ IndexTidDepth.php - Build the options form.
- IndexTidDepthModifier::buildOptionsForm in lib/
Views/ taxonomy/ Plugin/ views/ argument/ IndexTidDepthModifier.php - Build the options form.
- ManyToOne::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ ManyToOne.php - Build the options form.
- Null::buildOptionsForm in lib/
Drupal/ views/ Plugin/ views/ argument/ Null.php - Override buildOptionsForm() so that only the relevant options are displayed to the user.
File
- lib/
Drupal/ views/ Plugin/ views/ argument/ ArgumentPluginBase.php, line 161 - Definition of Drupal\views\Plugin\views\argument\ArgumentPluginBase.
Class
- ArgumentPluginBase
- Base class for arguments.
Namespace
Drupal\views\Plugin\views\argumentCode
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($form, $form_state);
$argument_text = $this->view->display_handler
->getArgumentText();
$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(
array(
$this,
'processContainerRadios',
),
),
'#default_value' => $this->options['default_action'],
'#fieldset' => 'no_argument',
);
$form['exception'] = array(
'#type' => 'fieldset',
'#title' => t('Exceptions'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#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"'),
);
$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.'),
'#states' => array(
'visible' => array(
':input[name="options[exception][title_enable]"]' => array(
'checked' => TRUE,
),
),
),
);
$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.'),
'#states' => array(
'visible' => array(
':input[name="options[title_enable]"]' => array(
'checked' => TRUE,
),
),
),
'#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.'),
'#states' => array(
'visible' => array(
':input[name="options[breadcrumb_enable]"]' => array(
'checked' => TRUE,
),
),
),
'#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',
);
$form['validate']['type'] = array(
'#type' => 'select',
'#title' => t('Validator'),
'#default_value' => $this->options['validate']['type'],
'#states' => array(
'visible' => array(
':input[name="options[specify_validation]"]' => array(
'checked' => TRUE,
),
),
),
);
$plugins = views_get_plugin_definitions('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.
'#input' => TRUE,
// trick it into checking input to make #process run
'#states' => array(
'visible' => array(
':input[name="options[specify_validation]"]' => array(
'checked' => TRUE,
),
':input[name="options[validate][type]"]' => array(
'value' => $id,
),
),
),
'#id' => 'edit-options-validate-options-' . $id,
);
$plugin
->buildOptionsForm($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,
'#states' => array(
'visible' => array(
':input[name="options[specify_validation]"]' => array(
'checked' => TRUE,
),
),
),
'#fieldset' => 'argument_present',
);
}