This is an issue which I see was covered for the 7.x-4.x branch. The closed issue is here https://drupal.org/node/2068165

This reappears in version 7.x-5.x. I noticed a comment about this needing to work for a number of entities and hence would be useful to implement hook_entity_delete.

Will attach a patch shortly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

christoph’s picture

fietserwin’s picture

7.x-5.x does not receive (m)any attention from me. From time to time I merge all changes from 4.x to 5.x. So unless you really need the Calendar as an entity, use the 7.x-4.x version.

Regarding the future of 7.x-5.x: I'm still in doubt about going all the way to entities, keep a mixed form or stay with a field after all. To complete the transition I would need to port the rendering code from a field formatter to an entity renderer. The same for the wiidget code.

Anyway, I will see if i can fnd some time to merge the last (4 or 5) commits from 4.x into 5.x to make 5.x up to date with bug solving and small features added.

fietserwin’s picture

Status: Active » Fixed

7.x-5.x already contains function availability_calendar_delete_calendar() and function availability_calendar_delete_availability(), so that part is fixed.

However, I did not add the function availability_calendar_entity_delete() function as you proposed, because there might be other references to the calendar, think of translations or otherwise shared calendars. Note that your code also contains an error as field_get_items() may return FALSE or otherwise will only return field items for 1 language. Thus when using entity_translation instead of i18n translation, not all calendars might be deleted (if calendars are not shared between languages ...)

If you want to delete calendar data on entity delete, you should implement this in your own project as there you know if and what translation model is used or that calendar may be shared otherwise.

Status: Fixed » Closed (fixed)

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