# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- views_handler_filter_selective.inc
+++ views_handler_filter_selective.inc
@@ -1,6 +1,7 @@
 <?php
 
 class views_handler_filter_selective extends views_handler_filter_in_operator {
+
   static $results;
 
   function get_value_options() {
@@ -14,8 +15,22 @@
         // Encode the values to keep special chars.
         $this->value_options = array_combine(array_map('urlencode', array_values($options)), array_values($options));
       }
+
+      // Modify value_options to include title for node reference fields.
+      if (isset($this->definition['options callback']) &&
+          $this->definition['options callback'] == 'node_reference_views_options') {
+        foreach ($this->value_options as $nid) {
+          $result = db_query('SELECT title FROM {node} WHERE nid = :nid', array(':nid' => $nid));
+          $title = $result->fetchField();
+          if (!empty($title)) {
+            $this->value_options[$nid] = $title;
     }
   }
+        // resort results based on title
+        asort($this->value_options);
+      }
+    }
+  }
 
   function value_form(&$form, &$form_state) {
     parent::value_form($form, $form_state);
@@ -39,7 +54,8 @@
     if (empty(self::$results[$signature])) {
       // Clone the view and get all results.
       $view_copy = views_get_view($this->view->name);
-      if (!$view_copy) return NULL;
+      if (!$view_copy)
+        return NULL;
       $view_copy->selective_oids = TRUE;
       $view_copy->set_exposed_input($exposed_input);
       $view_copy->set_arguments($this->view->args);
@@ -64,5 +80,6 @@
     }
     return self::$results[$signature];
   }
+
 }
 
