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

Comments

Fayna’s picture

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

Josh Benner’s picture

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!

Josh Benner’s picture

Status: Active » Postponed
vacilando’s picture

Subscribing...

Anonymous’s picture

+1 Also interested in this.

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

ianchan’s picture

subscribing

smoothify’s picture

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
StatusFileSize
new17.32 KB

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.

ianchan’s picture

subscribe

edrex’s picture

Status: Needs review » Reviewed & tested by the community

works for me, using on a production issue tracker site

flying_q’s picture

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;
  }
	
dixon_’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new16 KB

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

dixon_’s picture

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.

Status: Fixed » Closed (fixed)

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