diff options
Diffstat (limited to 'modules/taxonomy/taxonomy.pages.inc')
-rw-r--r-- | modules/taxonomy/taxonomy.pages.inc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/taxonomy/taxonomy.pages.inc b/modules/taxonomy/taxonomy.pages.inc index 26304136d..501ebbe10 100644 --- a/modules/taxonomy/taxonomy.pages.inc +++ b/modules/taxonomy/taxonomy.pages.inc @@ -108,7 +108,20 @@ function taxonomy_term_feed($term) { * @see taxonomy_field_widget_info() */ function taxonomy_autocomplete($field_name, $tags_typed = '') { - $field = field_info_field($field_name); + // If the request has a '/' in the search text, then the menu system will have + // split it into multiple arguments, recover the intended $tags_typed. + $args = func_get_args(); + // Shift off the $field_name argument. + array_shift($args); + $tags_typed = implode('/', $args); + + // Make sure the field exists and is a taxonomy field. + if (!($field = field_info_field($field_name)) || $field['type'] !== 'taxonomy_term_reference') { + // Error string. The JavaScript handler will realize this is not JSON and + // will display it as debugging information. + print t('Taxonomy field @field_name not found.', array('@field_name' => $field_name)); + exit; + } // The user enters a comma-separated list of tags. We only autocomplete the last tag. $tags_typed = drupal_explode_tags($tags_typed); |