diff --git a/modules/taxonomy/views_handler_filter_term_node_tid.inc b/modules/taxonomy/views_handler_filter_term_node_tid.inc
index 5ca6d18..a5f247f 100644
--- a/modules/taxonomy/views_handler_filter_term_node_tid.inc
+++ b/modules/taxonomy/views_handler_filter_term_node_tid.inc
@@ -42,6 +42,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
     $options['vocabulary'] = array('default' => 0);
     $options['hierarchy'] = array('default' => 0);
     $options['error_message'] = array('default' => TRUE, 'bool' => TRUE);
+    $options['optgroups'] = array('default' => 0);
 
     return $options;
   }
@@ -84,6 +85,14 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
       '#default_value' => !empty($this->options['hierarchy']),
       '#dependency' => array('radio:options[type]' => array('select')),
     );
+    
+    $form['optgroups'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show groups in dropdown'),
+      '#default_value' => !empty($this->options['optgroups']),
+      '#dependency' => array('radio:options[type]' => array('select')),
+    );
+   
   }
 
   function value_form(&$form, &$form_state) {
@@ -119,15 +128,21 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
     }
     else {
       if (!empty($this->options['hierarchy']) && $this->options['limit']) {
-        $tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE);
-        $options = array();
-
-        if ($tree) {
-          // Translation system needs full entity objects, so we have access to label.
-          foreach ($tree as $term) {
-            $choice = new stdClass();
-            $choice->option = array($term->tid => str_repeat('-', $term->depth) . entity_label('taxonomy_term', $term));
-            $options[] = $choice;
+        if ($tree = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE)) {
+          if ($this->options['optgroups']) {
+            foreach ($tree as $term) {
+              if ($term->parents[0] == 0) {
+                $parent_name = $term->name;
+              }
+              else {
+                $options[$parent_name][$term->tid] = str_repeat('-', $term->depth - 1) . $term->name;
+              }
+            }
+          }
+          else {
+            foreach ($tree as $term) {
+              $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
+            }
           }
         }
       }
