Created
August 15, 2012 11:47
-
-
Save damiankloip/3359453 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/handlers/views_handler_filter.inc b/handlers/views_handler_filter.inc | |
index de6dc9f..63a10c3 100644 | |
--- a/handlers/views_handler_filter.inc | |
+++ b/handlers/views_handler_filter.inc | |
@@ -114,6 +114,7 @@ class views_handler_filter extends views_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' => ''), | |
@@ -138,6 +139,7 @@ class views_handler_filter extends views_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'), | |
@@ -488,6 +490,12 @@ class views_handler_filter extends views_handler { | |
'#size' => 40, | |
); | |
+ $form['expose']['description'] = array( | |
+ '#type' => 'textfield', | |
+ '#default_value' => $this->options['expose']['description'], | |
+ '#title' => t('Description'), | |
+ ); | |
+ | |
if (!empty($form['operator']['#type'])) { | |
// Increase the width of the left (operator) column. | |
$form['operator']['#prefix'] = '<div class="views-group-box views-left-40">'; | |
@@ -660,6 +668,7 @@ class views_handler_filter extends views_handler { | |
'operator' => $this->options['id'] . '_op', | |
'identifier' => $this->options['id'], | |
'label' => $this->definition['title'], | |
+ 'description' => NULL, | |
'remember' => FALSE, | |
'multiple' => FALSE, | |
'required' => FALSE, | |
@@ -672,6 +681,7 @@ class views_handler_filter extends views_handler { | |
function build_group_options() { | |
$this->options['group_info'] = array( | |
'label' => $this->definition['title'], | |
+ 'description' => NULL, | |
'identifier' => $this->options['id'], | |
'optional' => TRUE, | |
'widget' => 'select', | |
@@ -816,6 +826,7 @@ class views_handler_filter extends views_handler { | |
'#title' => t('Label'), | |
'#size' => 40, | |
); | |
+ | |
$form['group_info']['optional'] = array( | |
'#type' => 'checkbox', | |
'#title' => t('Optional'), | |
@@ -865,6 +876,11 @@ class views_handler_filter extends views_handler { | |
'#title' => t('Label'), | |
'#size' => 40, | |
); | |
+ $form['group_info']['description'] = array( | |
+ '#type' => 'textfield', | |
+ '#default_value' => $this->options['group_info']['description'], | |
+ '#title' => t('Description'), | |
+ ); | |
$form['group_info']['optional'] = array( | |
'#type' => 'checkbox', | |
'#title' => t('Optional'), | |
@@ -1108,6 +1124,7 @@ class views_handler_filter extends views_handler { | |
return array( | |
'value' => $this->options['group_info']['identifier'], | |
'label' => $this->options['group_info']['label'], | |
+ 'description' => $this->options['group_info']['description'], | |
); | |
} | |
@@ -1115,6 +1132,7 @@ class views_handler_filter extends views_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/includes/admin.inc b/includes/admin.inc | |
index 5ba7135..e1d1885 100644 | |
--- a/includes/admin.inc | |
+++ b/includes/admin.inc | |
@@ -3516,6 +3516,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']); | |
@@ -3566,6 +3567,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>'; | |
diff --git a/theme/theme.inc b/theme/theme.inc | |
index d4182df..52598d5 100644 | |
--- a/theme/theme.inc | |
+++ b/theme/theme.inc | |
@@ -936,16 +936,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 c0861f2..2a09ac9 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->label)): ?> | |
+ <div class="description"> | |
+ <?php print $widget->description; ?> | |
+ </div> | |
+ <?php endif; ?> | |
</div> | |
<?php endforeach; ?> | |
<?php if (!empty($sort_by)): ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment