Project:Enhanced Nodereference Autocomplete Widget
Version:5.x-1.3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Can't wait to see an 6.x Version :)

Comments

#1

Me neither!! I loved this module! It should totally be in CCK core. :)

#2

Unless someone beats me to it, I probably won't be porting this to D6 until I suddenly run upon spare time or I need a D6 version for a client. Any contributions are always appreciated!

#3

Status:active» postponed

#4

Subscribing...

#5

+1 Also interested in this.

Unfortunately I'm not a developer, but I can test anything that is patched for stability!

txcrew

#6

subscribing

#7

Title:Can't wait to see an 6.x Version :)» Drupal 6 version of nr_autocomplete
Version:5.x-1.2» 5.x-1.3
Status:postponed» needs review

I needed this module to migrate my site to drupal 6 so i've attached a patch with the changes i've made.

Since cck's widget api has changed considerably there is a lot of new code in it, but where possible I borrowed from the main nodereference module.

So far with light testing it seems to work fine for me.

AttachmentSize
nr_autocomplete_d6.patch 17.32 KB

#8

subscribe

#9

Status:needs review» reviewed & tested by the community

works for me, using on a production issue tracker site

#10

Hi all....I've attempted to implement the patch and I'm getting the following error:

warning: Invalid argument supplied for foreach() in /home/.../modules/nr_autocomplete/nr_autocomplete.module on line 228.

I have included the snippet below where the error is occurring. Any help would be greatly appreciated!

/**
* Validate an autocomplete element.
*
* Remove the wrapper layer and set the right element's value.
* This will move the nested value at 'field-name-0-nid-nid'
* back to its original location, 'field-name-0-nid'.
*/
function nr_autocomplete_validate($element, &$form_state) {
  $field_name = $element['#field_name'];
  $type_name = $element['#type_name'];
  $field = content_fields($field_name, $type_name);
  $field_key  = $element['#columns'][0];
  $delta = $element['#delta'];
  $value = $element['#value'][$field_key];
  $values = array();
  $nid = NULL;
  $typed_titles = nr_autocomplete_parse_input($value);
  foreach ($typed_titles as $delta => $item) {
    if (!empty($item)) {
      preg_match('/^(?:\s*|(.*) )?\[\s*nid\s*:\s*(\d+)\s*\]$/', $item, $matches);
      if (!empty($matches)) {
         // Explicit [nid:n].
        list(, $title, $nid) = $matches;       
        // Check for encoded and unencoded matches
        if (!empty($title) && ($n = node_load($nid)) && nr_autocomplete_encode($title) != $n->title && $title != $n->title) {
          form_error($element[$field_key], t('%name: title mismatch. Please check your selection.', array('%name' => t($field['widget']['label']))));
         }
        }
        else {
          $values[] = array('nid' => $nid);
        }
      }
      break;
    }   
  }
  $new_parents = array();

****---->>>>> ERROR HERE  foreach ($element['#parents'] as $parent) {

    $value = $value[$parent];
    // Use === to be sure we get right results if parent is a zero (delta) value.
    if ($parent === $field_key) {
      $element['#parents'] = $new_parents;
      form_set_value($element, $values, $form_state);
       break;
    }
    $new_parents[] = $parent;
  }

#11

Status:reviewed & tested by the community» needs review

Here is a re-rolled patch originally taken from #7. This patch only includes some minor code style fixes and cleanup.

AttachmentSize
nr_autocomplete_d6_2.patch 16 KB

#12

Status:needs review» fixed

Josh Benner has accepted me as a co-maintainer, and I've now committed a first stab at the 6.x branch. Checkout the code from CVS if the packaging script hasn't packed the release yet.

#13

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here