When using the embedded widget removed field collections get never deleted.
We probably should implement hook_field_update() and check for removed field collections and delete them once removed.
When using the embedded widget removed field collections get never deleted.
We probably should implement hook_field_update() and check for removed field collections and delete them once removed.
Comments
Comment #1
fagoI've committed a fix for that + an update routine that takes care of deleting orphaned field collection items. Please test and report whether the update went fine for you.
Comment #2
Niremizov commentedI belive this issue somehow related with #1781190: Field Collection saved on presave.
Comment #3
cornelyus commentedHello all
I think I have the same problem..
I have the latest dev from fago, and what happens to me is this.
I fill one field collection
then Add Another Item
If I click remove on this last item, it doesn't disappear.. If I click a second time what it does is, it saves my node form.
What I saw on the module was that the first time I click "Remove" the button comes with info that is of type submit, and name Remove.
The second time this changes and it says it's of type submit, and name Save.
I am talking about this piece of code :
// Get the information on what we're removing.
$button = $form_state['triggering_element'];
Thanks for your time..
Comment #5
jamsilver commentedGlad this has been finally fixed! Marked #1186826: Delete orphaned field_collection_item entities when they are (programatically) removed from the host entity as a duplicate.
Just a small note: This solution doesn't work if the host entity of the field collection is of an entity type declared (by a custom module) without the use of entity api. Of course in that tiny tiny case, the best answer would probably be to rewrite your module to use entity api!
This is because of the code's reliance on the $entity->original property - something placed there by entity api.
Comment #6
Nick Robillard commentedfago: what's the commit this happened on?
EDIT: Nevermind - it's painfully obvious when I look at the commits. :)
Comment #7
nithinkolekar commentedis it committed in 7.x-1.0-beta7 ?
don't find patch code(https://drupal.org/comment/5637234#comment-5637234) in latest version.