When saving a bulk-edit form that contains a field for a taxonomy free-tagging vocabulary, I receive the following errors:

Notice: Undefined index: field in field_widget_field() (line 578 of /docroot/modules/field/field.form.inc).
Warning: Invalid argument supplied for foreach() in taxonomy_autocomplete_validate() (line 1750 of /docroot/modules/taxonomy/taxonomy.module).
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => Tag name ) in DrupalDefaultEntityController->load() (line 196 of /Users/nate/Sites/grammy4/docroot/includes/entity.inc).
#1 node_gallery_tags-1901730.patch2.19 KBquicksketch


new2.19 KB

Okay, this is difficult to follow, but essentially the problem looks like this:

- Node Gallery builds pseudo node forms, then pulls out the portions of the form that should be shown in the bulk edit form.
- While generating this form, Field module adds contents to $form_state['field'], however the temporary form_state generated by node gallery is *discarded* after the temporary node form is generated.
- Some modules (like taxonomy in taxonomy_autocomplete_validate()) attempt to retrieve the field instance from $form_state['field'] using field_widget_field(). Upon submission, the validation of the form fails because $form_state['field'] is empty.

The easiest solution I could think of is to update $form_state['field'] in the original form state when generating the temporary node forms. This may run into conflicts when there are multiple node-types that are defined as children of the same gallery type, and they share the same fields that have different configurations. Since only one field instance can live in the global $form_state['field'] array, two instances that have different settings might face problems.

I doubt this is the best solution. I think there are dedicated functions for editing just part of an entity in D7 that we're not utilizing in Node Gallery, but I haven't done in-depth research there to know if that statement is entirely accurate.

Status:Active» Fixed

Patch looks good.

I can see where this could be a problem for mixed content types, but I think that config should be fairly rare now that we can handle mixed media with File Entity. If someone has that config and finds a problem, perhaps they can supply a patch. :)

Committed: http://drupalcode.org/project/node_gallery.git/commit/8a91422

Status:Fixed» Closed (fixed)

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