When the commas were added to the form it had the negative side effect of breaking CCK's content_copy functions. As it currently stands, any content type consisting of more than one filefield property (or more than one imagefield property) will presently export with file extensions like this:

png,, jpg,, gif

export it again and you see the number of commas grow :-(

The problem is that content_copy must use a drupal_execute() to generate a macro for content type creation. drupal_execute() executes the form for the content type and while that execution includes running the hook_form_validate() portion of filefield, Drupal core only allows the hook_form_validate() to run once per form_id. As a result, while the first set of file extensions in a content type won't be negatively affected by the cosmetic change, subsequent filefields will not have the commas stripped, making exports unusable without a manual edit.

I'm thinking that any module that makes use of drupal_execute() in relation to a content type with a filefield will have this problem.

I've written a patch to fix the problem though, so have fun with that.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Status: Patch (to be ported) » Needs work

Commas are a natural thing for users to enter, rather than spaces. This same code is in Drupal 7 also, so we'll have the same problem there. Perhaps we can set the value and add the commas in #pre_render or some other location.

quicksketch’s picture

Title: The addition of commas to the form breaks other modules irrevocably » Commas in extension list breaks content_copy exports
Status: Needs work » Fixed
FileSize
1.8 KB

I've committed this patch which moves the addition of commas to the cosmetic-only #pre_render location. This makes it so that commas are shown to the user but excluded from exports, since drupal_execute() doesn't run render out the form, the commas are never added when dealing with drupal_execute().

Status: Fixed » Closed (fixed)

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