Followup on #386288: Reduce standard 2 upload sections to 1 when "Unlimited" number of values which is now closed and thus doesn't appear on most issue list:
In #386288, the number of values was intentionaly set to 0 to make only one filefield appear on the edit page, assuming that 1 would always be added to it.
This is now longer true in the latest CCK 6.x-3 development branch where #196421: Deleting unwanted multiple values / multiple values delta issues was fixed: with the patch, there's exactly as many upload fields as the default item_count, which means that there's now 0 upload field by default. This is rather suboptimal UI wise, and produces a warning when the first field is added due to CCK assuming that at least one value was providing in its add more handler.
I'm not sure there's anything simple that can be done to make only one field appear in the edit form that works /both/ in CCK 2 and CCK 3. I guess the simplest thing to do would be to rollback the patch applied for #386288 once there's an actual release of CCK 3.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | filefield_cck3_default_values.patch | 1.04 KB | quicksketch |
Comments
Comment #1
quicksketchI've applied the attached patch to work-around this problem for the time being. It's difficult to tell the difference between CCK 2 and 3, because there are no database updates between them. It doesn't make sense for CCK to provide a "CCK version" variable or something similar, because yched plans on merging CCK 3 back into the CCK 2 branch once it stabilizes. So it's not really a different version at all, it's just an improved one.
So what I've done here is just check for the function that is responsible for the new "Remove" button, which exists in the new version but not in the old one, and only making the adjustment if using the older version.
I'm not super-sure this is the best approach, especially since it's now a hack on top of a hack. But at least it works for both versions regardless and should correct this important problem when using CCK 3 with FileField.
Comment #2
quicksketchComment #4
markus_petrux commentedSorry to bump this issue, but I was not aware of this problem until today that was reported in the CCK queue (#595898: Error on upgrading from CCK 2.5 to 3 with FileField and ImageField). I was able to track the issue and I figured it would have to be fixed in CCK3 itself.
For reference: #551188: "Add another item" for FileField widgets causes Invalid argument supplied for foreach() in content.node_form.inc on line 456
I think you can safely revert the patch in #1 above. It should cause no harm as it is, anyway. CCK3 still provides a single widget for unlimited widgets. That fix I committed is just to make sure there's 1 widget minimum, which was the cause of troubles for some people on the above mentioned issue.
Apologies for the headaches. :-/
PS: Eventhough this issue is closed, I hope it bumps in the recent posts list of those who posted here.