Open sh0rtwave opened 8 years ago
Fix for situation when an entity has no id (e.g. it's new, and hasn't been saved yet). og-widget-breaks-onscald-multi-upload-id-fix-114.patch.txt
+1 for this. Scald is a fantastic media management module and the plupload option for creating multiple atoms at once is indispensable. The widget should not natively assume that there is only one form on the page and allow for multiples and also for entities still in the process of being created.
When using Scald's multiple upload functionality when creating new Media Atoms, Organic Groups fields will only appear on the first item in the upload.
This is because in includes/og-field.inc, in the function og_field_widget_form(), at the time that each Scald atom comes through the function, it doesn't have a entity ID. It has a scald-assigned "base_id" only.
See the following code from og_field_widget_form():
At the point where the $identifier is tested against the cache, since the $id is returned as NULL from entity_extract_ids (because the atoms haven't actually been saved), the $identifier will be the exact same string for all forms that need to be created.
This is a pretty obscure bug, since most people won't encounter this (and it happens to work just fine for most people, since most entities are usually created one at a time) but it does cause issues with things like Scald.