diff --git a/css/views-admin.seven.css b/css/views-admin.seven.css index 6ebdbf1fd3e6..d58bb1be5f4f 100644 --- a/css/views-admin.seven.css +++ b/css/views-admin.seven.css @@ -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; } diff --git a/css/views-admin.theme.css b/css/views-admin.theme.css index ee52fd2d9426..8611783f7e5d 100644 --- a/css/views-admin.theme.css +++ b/css/views-admin.theme.css @@ -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; diff --git a/includes/admin.inc b/includes/admin.inc index e9b9e061c381..6dff0ba88b41 100644 --- a/includes/admin.inc +++ b/includes/admin.inc @@ -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 .= '
'; $output .= drupal_render($form['widget']); $output .= drupal_render($form['label']); + $output .= drupal_render($form['description']); $output .= '
'; $header = array( diff --git a/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php index ca1759e18b61..ab230edfe417 100644 --- a/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php +++ b/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php @@ -120,6 +120,7 @@ abstract class FilterPluginBase extends Handler { '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 @@ abstract class FilterPluginBase extends Handler { $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 @@ abstract class FilterPluginBase extends Handler { '#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'] = '
'; @@ -668,6 +677,7 @@ abstract class FilterPluginBase extends Handler { '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 @@ abstract class FilterPluginBase extends Handler { 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 @@ abstract class FilterPluginBase extends Handler { '#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 @@ abstract class FilterPluginBase extends Handler { return array( 'value' => $this->options['group_info']['identifier'], 'label' => $this->options['group_info']['label'], + 'description' => $this->options['group_info']['description'], ); } @@ -1123,6 +1141,7 @@ abstract class FilterPluginBase extends Handler { 'operator' => $this->options['expose']['operator_id'], 'value' => $this->options['expose']['identifier'], 'label' => $this->options['expose']['label'], + 'description' => $this->options['expose']['description'], ); } diff --git a/theme/theme.inc b/theme/theme.inc index e781683fb0ff..613f1b9bbacd 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -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; } diff --git a/theme/views-exposed-form.tpl.php b/theme/views-exposed-form.tpl.php index c0861f2fe463..bdd570c228a8 100644 --- a/theme/views-exposed-form.tpl.php +++ b/theme/views-exposed-form.tpl.php @@ -43,6 +43,11 @@
widget; ?>
+ description)): ?> +
+ description; ?> +
+