function taxonomy_autocomplete($field_name, $bundle, $tags_typed = '') {
  $instance = field_info_instance($field_name, $bundle);

As of #470242: Namespacing for bundle names, field_info_instance() takes $obj_type as its first argument, so the page callback needs to receive that info as well.
Also changed the widget code to actually make use of the 'autocomplete_path' widget setting instead of hardcoding 'taxonomy/autocomplete/...'.

Which brings: #631058: Expose taxonomy autocomplete 'size' variable to the UI

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

+++ modules/taxonomy/taxonomy.module	12 Nov 2009 17:11:03 -0000
@@ -1216,8 +1216,7 @@ function taxonomy_field_widget(&$form, &
+    '#autocomplete_path' => $instance['widget']['settings']['autocomplete_path'] .'/'. $instance['object_type'] . '/' . $instance['bundle'] .'/'. $field['field_name'],

Wrong string concatenation here (there should be a space on both sides of the period)

+++ modules/taxonomy/taxonomy.pages.inc	12 Nov 2009 17:06:25 -0000
@@ -77,8 +77,8 @@ function taxonomy_term_feed($term) {
-function taxonomy_autocomplete($field_name, $bundle, $tags_typed = '') {
-  $instance = field_info_instance($field_name, $bundle);
+function taxonomy_autocomplete($obj_type, $bundle, $field_name, $tags_typed = '') {
+  $instance = field_info_instance($obj_type, $field_name, $bundle);

Looking at the real function signature of field_info_isntance(), I somehow wonder how the code was able to work before... is $instance used at all in this function?

I'm on crack. Are you, too?

Dries’s picture

This smells like we need more/better tests. ;-)

yched’s picture

FileSize
1.72 KB

Doh, taxonomy_autocomplete() in fact doesn't use the $instance - rightly so, AFAICT there's no instance-level stuff that would affect its behavior.
Well, that's different, then - it doesn't need the $bundle param either.

sun’s picture

+++ modules/taxonomy/taxonomy.module	12 Nov 2009 17:11:03 -0000
@@ -1216,8 +1216,7 @@ function taxonomy_field_widget(&$form, &
-    '#autocomplete_path' => 'taxonomy/autocomplete/'. $field['field_name'] .'/'. $instance['bundle'],
+    '#autocomplete_path' => $instance['widget']['settings']['autocomplete_path'] .'/'. $instance['object_type'] . '/' . $instance['bundle'] .'/'. $field['field_name'],

But what happened to this nicety now?

This review is powered by Dreditor.

yched’s picture

Title: taxo autocomplete path misses $object_type » taxonomy_autocomplete() doesn't need to access $instance
FileSize
1.76 KB

Ah, right, I rolled a new patch from scratch but forgot the $instance['widget']['settings']['autocomplete_path'] bit.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Great! :)

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks yched.

Status: Fixed » Closed (fixed)

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