Index: modules/nodereference/nodereference.module
===================================================================
--- modules/nodereference/nodereference.module	(révision 2366)
+++ modules/nodereference/nodereference.module	(copie de travail)
@@ -468,6 +468,7 @@
     case 'form':
       $form = array();
       $match = isset($widget['autocomplete_match']) ? $widget['autocomplete_match'] : 'contains';
+      $count = (isset($widget['autocomplete_count']) && is_numeric($widget['autocomplete_count'])) ? $widget['autocomplete_count'] : 10;
       $size = (isset($widget['size']) && is_numeric($widget['size'])) ? $widget['size'] : 60;
       if ($widget['type'] == 'nodereference_autocomplete') {
         $form['autocomplete_match'] = array(
@@ -480,6 +481,12 @@
           ),
           '#description' => t('Select the method used to collect autocomplete suggestions. Note that <em>Contains</em> can cause performance issues on sites with thousands of nodes.'),
         );
+        $form['autocomplete_count'] = array(
+          '#type' => 'textfield',
+          '#title' => t('Autocomplete results count'),
+          '#default_value' => $count,
+          '#description' => t('Select how many results will be displayed in the autocomplete dropdown.'),
+        );
         $form['size'] = array(
           '#type' => 'textfield',
           '#title' => t('Size of textfield'),
@@ -495,7 +502,7 @@
       return $form;
 
     case 'save':
-      return array('autocomplete_match', 'size');
+      return array('autocomplete_match', 'autocomplete_count', 'size');
   }
 }
 
@@ -970,9 +977,10 @@
   $fields = content_fields();
   $field = $fields[$field_name];
   $match = isset($field['widget']['autocomplete_match']) ? $field['widget']['autocomplete_match'] : 'contains';
+  $count = isset($field['widget']['autocomplete_count']) ? $field['widget']['autocomplete_count'] : 10;
   $matches = array();
 
-  $references = _nodereference_potential_references($field, $string, $match, array(), 10);
+  $references = _nodereference_potential_references($field, $string, $match, array(), $count);
   foreach ($references as $id => $row) {
     // Add a class wrapper for a few required CSS overrides.
     $matches[$row['title'] ." [nid:$id]"] = '<div class="reference-autocomplete">'. $row['rendered'] . '</div>';
