Commit 5e4b5ff6 authored by damiankloip's avatar damiankloip Committed by tim.plunkett
Browse files

Issue #1732672 by damiankloip, dawehner: Added description option to exposed filters.

parent 40d5f16f
......@@ -127,7 +127,8 @@ fieldset.fieldset-no-legend {
.dependent-options,
.dependent-options.form-item,
.form-item-options-expose-required,
.form-item-options-expose-label {
.form-item-options-expose-label,
.form-item-options-expose-description {
margin-left: 1.5em;
}
......@@ -139,7 +140,8 @@ fieldset.fieldset-no-legend {
.views-admin-dependent .dependent-options .form-type-select,
.views-admin-dependent .dependent-options .form-type-textfield,
.form-item-options-expose-required,
.form-item-options-expose-label {
.form-item-options-expose-label,
.form-item-options-expose-description {
margin-bottom: 6px;
margin-top: 6px;
}
......
......@@ -933,7 +933,8 @@ ul#views-display-menu-tabs li.add ul.action-list li{
/* @group Expose filter form items */
.form-item-options-expose-required,
.form-item-options-expose-label {
.form-item-options-expose-label,
.form-item-options-expose-description {
margin-bottom: 6px;
margin-left: 18px;
margin-top: 6px;
......
......@@ -3508,6 +3508,7 @@ function theme_views_ui_expose_filter_form($variables) {
$output .= drupal_render($form['required']);
}
$output .= drupal_render($form['label']);
$output .= drupal_render($form['description']);
$output .= drupal_render($form['operator']);
$output .= drupal_render($form['value']);
......@@ -3558,6 +3559,7 @@ function theme_views_ui_build_group_filter_form($variables) {
$output .= '<div class="views-right-60">';
$output .= drupal_render($form['widget']);
$output .= drupal_render($form['label']);
$output .= drupal_render($form['description']);
$output .= '</div>';
$header = array(
......
......@@ -120,6 +120,7 @@ function option_definition() {
'contains' => array(
'operator_id' => array('default' => FALSE),
'label' => array('default' => '', 'translatable' => TRUE),
'description' => array('default' => '', 'translatable' => TRUE),
'use_operator' => array('default' => FALSE, 'bool' => TRUE),
'operator' => array('default' => ''),
'identifier' => array('default' => ''),
......@@ -144,6 +145,7 @@ function option_definition() {
$options['group_info'] = array(
'contains' => array(
'label' => array('default' => '', 'translatable' => TRUE),
'description' => array('default' => '', 'translatable' => TRUE),
'identifier' => array('default' => ''),
'optional' => array('default' => TRUE, 'bool' => TRUE),
'widget' => array('default' => 'select'),
......@@ -494,6 +496,13 @@ function expose_form(&$form, &$form_state) {
'#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">';
......@@ -668,6 +677,7 @@ function expose_options() {
'operator' => $this->options['id'] . '_op',
'identifier' => $this->options['id'],
'label' => $this->definition['title'],
'description' => NULL,
'remember' => FALSE,
'multiple' => FALSE,
'required' => FALSE,
......@@ -680,6 +690,7 @@ function expose_options() {
function build_group_options() {
$this->options['group_info'] = array(
'label' => $this->definition['title'],
'description' => NULL,
'identifier' => $this->options['id'],
'optional' => TRUE,
'widget' => 'select',
......@@ -824,6 +835,12 @@ function build_group_form(&$form, &$form_state) {
'#title' => t('Label'),
'#size' => 40,
);
$form['group_info']['description'] = array(
'#type' => 'textfield',
'#default_value' => $this->options['group_info']['description'],
'#title' => t('Description'),
'#size' => 60,
);
$form['group_info']['optional'] = array(
'#type' => 'checkbox',
'#title' => t('Optional'),
......@@ -1116,6 +1133,7 @@ function exposed_info() {
return array(
'value' => $this->options['group_info']['identifier'],
'label' => $this->options['group_info']['label'],
'description' => $this->options['group_info']['description'],
);
}
......@@ -1123,6 +1141,7 @@ function exposed_info() {
'operator' => $this->options['expose']['operator_id'],
'value' => $this->options['expose']['identifier'],
'label' => $this->options['expose']['label'],
'description' => $this->options['expose']['description'],
);
}
......
......@@ -934,16 +934,23 @@ function template_preprocess_views_exposed_form(&$vars) {
}
$widget = new stdClass;
// set up defaults so that there's always something there.
$widget->label = $widget->operator = $widget->widget = NULL;
$widget->label = $widget->operator = $widget->widget = $widget->description = NULL;
$widget->id = isset($form[$info['value']]['#id']) ? $form[$info['value']]['#id'] : '';
if (!empty($info['label'])) {
$widget->label = check_plain($info['label']);
}
if (!empty($info['operator'])) {
$widget->operator = drupal_render($form[$info['operator']]);
}
$widget->widget = drupal_render($form[$info['value']]);
if (!empty($info['description'])) {
$widget->description = check_plain($info['description']);
}
$vars['widgets'][$id] = $widget;
}
......
......@@ -43,6 +43,11 @@
<div class="views-widget">
<?php print $widget->widget; ?>
</div>
<?php if (!empty($widget->description)): ?>
<div class="description">
<?php print $widget->description; ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php if (!empty($sort_by)): ?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment