public function views_handler_filter::expose_form in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.2 handlers/views_handler_filter.inc \views_handler_filter::expose_form()
Options form subform for exposed filter options.
Overrides views_handler::expose_form
See also
options_form()
2 calls to views_handler_filter::expose_form()
- views_handler_filter_history_user_timestamp::expose_form in modules/
node/ views_handler_filter_history_user_timestamp.inc - Options form subform for exposed filter options.
- views_handler_filter_in_operator::expose_form in handlers/
views_handler_filter_in_operator.inc - Options form subform for exposed filter options.
2 methods override views_handler_filter::expose_form()
- views_handler_filter_history_user_timestamp::expose_form in modules/
node/ views_handler_filter_history_user_timestamp.inc - Options form subform for exposed filter options.
- views_handler_filter_in_operator::expose_form in handlers/
views_handler_filter_in_operator.inc - Options form subform for exposed filter options.
File
- handlers/
views_handler_filter.inc, line 520 - Definitions of views_handler_filter and views_handler_filter_broken.
Class
- views_handler_filter
- Base class for filters.
Code
public function expose_form(&$form, &$form_state) {
$form['#theme'] = 'views_ui_expose_filter_form';
// #flatten will move everything from $form['expose'][$key] to $form[$key]
// prior to rendering. That's why the pre_render for it needs to run first,
// so that when the next pre_render (the one for fieldsets) runs, it gets
// the flattened data.
array_unshift($form['#pre_render'], 'views_ui_pre_render_flatten_data');
$form['expose']['#flatten'] = TRUE;
if (empty($this->always_required)) {
$form['expose']['required'] = array(
'#type' => 'checkbox',
'#title' => t('Required'),
'#default_value' => $this->options['expose']['required'],
);
$operator_options = $this
->operator_options();
if (count($operator_options)) {
$form['expose']['limit_operators'] = array(
'#type' => 'checkbox',
'#title' => t('Limit operators'),
'#description' => t('When checked, the operator will be exposed to the user'),
'#default_value' => !empty($this->options['expose']['limit_operators']),
'#dependency' => array(
'edit-options-expose-use-operator' => array(
1,
),
),
'#description' => t('Restrict which operators will be available to select in the exposed operator form.'),
);
$form['expose']['available_operators'] = array(
'#type' => 'checkboxes',
'#title' => t('Limit the exposed operators'),
'#default_value' => $this->options['expose']['available_operators'],
'#prefix' => '<div id="edit-options-expose-available-operators-wrapper"><div id="edit-options-expose-available-operators">',
'#suffix' => '</div></div>',
'#description' => t('Select which operators will be available to select in the exposed operator form. If none are selected, all the operators listed here will be used.'),
'#options' => $operator_options,
'#dependency' => array(
'edit-options-expose-limit-operators' => array(
1,
),
),
);
}
}
else {
$form['expose']['required'] = array(
'#type' => 'value',
'#value' => TRUE,
);
}
$form['expose']['label'] = array(
'#type' => 'textfield',
'#default_value' => $this->options['expose']['label'],
'#title' => t('Label'),
'#size' => 40,
);
$form['expose']['description'] = array(
'#type' => 'textfield',
'#default_value' => $this->options['expose']['description'],
'#title' => t('Description'),
'#size' => 60,
);
if (!empty($form['operator']['#type'])) {
// Increase the width of the left (operator) column.
$form['operator']['#prefix'] = '<div class="views-group-box views-left-40">';
$form['operator']['#suffix'] = '</div>';
$form['value']['#prefix'] = '<div class="views-group-box views-right-60">';
$form['value']['#suffix'] = '</div>';
$form['expose']['use_operator'] = array(
'#type' => 'checkbox',
'#title' => t('Expose operator'),
'#description' => t('Allow the user to choose the operator.'),
'#default_value' => !empty($this->options['expose']['use_operator']),
);
$form['expose']['operator_label'] = array(
'#type' => 'textfield',
'#default_value' => $this->options['expose']['operator_label'],
'#title' => t('Operator label'),
'#size' => 40,
'#description' => t('This will appear before your operator select field.'),
'#dependency' => array(
'edit-options-expose-use-operator' => array(
1,
),
),
);
$form['expose']['operator_id'] = array(
'#type' => 'textfield',
'#default_value' => $this->options['expose']['operator_id'],
'#title' => t('Operator identifier'),
'#size' => 40,
'#description' => t('This will appear in the URL after the ? to identify this operator.'),
'#dependency' => array(
'edit-options-expose-use-operator' => array(
1,
),
),
'#fieldset' => 'more',
);
}
else {
$form['expose']['operator_id'] = array(
'#type' => 'value',
'#value' => '',
);
}
if (empty($this->always_multiple)) {
$form['expose']['multiple'] = array(
'#type' => 'checkbox',
'#title' => t('Allow multiple selections'),
'#description' => t('Enable to allow users to select multiple items.'),
'#default_value' => $this->options['expose']['multiple'],
);
}
$form['expose']['remember'] = array(
'#type' => 'checkbox',
'#title' => t('Remember the last selection'),
'#description' => t('Enable to remember the last selection made by the user.'),
'#default_value' => $this->options['expose']['remember'],
);
$role_options = array_map('check_plain', user_roles());
$form['expose']['remember_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('User roles'),
'#description' => t('Remember exposed selection only for the selected user role(s). If you select no roles, the exposed data will never be stored.'),
'#default_value' => $this->options['expose']['remember_roles'],
'#options' => $role_options,
'#dependency' => array(
'edit-options-expose-remember' => array(
1,
),
),
);
$form['expose']['identifier'] = array(
'#type' => 'textfield',
'#default_value' => $this->options['expose']['identifier'],
'#title' => t('Filter identifier'),
'#size' => 40,
'#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
'#fieldset' => 'more',
);
}