diff --git a/css/views-admin.seven.css b/css/views-admin.seven.css index 6ebdbf1fd3e6bee90e938194d94493ccc04b2c1b..d58bb1be5f4f31555743c024453034a4edcde39e 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 ee52fd2d94263040b684f7ac7652ec999836d397..8611783f7e5dc8d6db39d9d8854af6c748822cc7 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 e9b9e061c381ad2914644c71b49e8a1e3446b1f2..6dff0ba88b4128c49565cecfddf478f4218bb958 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 .= '<div class="views-right-60">'; $output .= drupal_render($form['widget']); $output .= drupal_render($form['label']); + $output .= drupal_render($form['description']); $output .= '</div>'; $header = array( diff --git a/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php b/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php index ca1759e18b618f3cf17e2220620aa77ac1f0daeb..ab230edfe417afcc2c2e34321d2a29737ffa0ecc 100644 --- a/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php +++ b/lib/Drupal/views/Plugin/views/filter/FilterPluginBase.php @@ -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'], ); } diff --git a/theme/theme.inc b/theme/theme.inc index e781683fb0ff5903e1ff34fb0cc8896a8baf56b9..613f1b9bbacd1fcb2980a888b7d05525cd169bb8 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 c0861f2fe46393c98b12774a7916c6c757035ba1..bdd570c228a87c14ccf02d22a2f40d31936bb4e8 100644 --- a/theme/views-exposed-form.tpl.php +++ b/theme/views-exposed-form.tpl.php @@ -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)): ?>