diff --git a/widgets/WidgetArea.php b/widgets/WidgetArea.php index a7bcb3b47..1b35084d2 100644 --- a/widgets/WidgetArea.php +++ b/widgets/WidgetArea.php @@ -46,6 +46,13 @@ class WidgetArea extends DataObject { function forTemplate() { return $this->renderWith($this->class); } + + function onBeforeDelete() { + parent::onBeforeDelete(); + foreach($this->Widgets() as $widget) { + $widget->delete(); + } + } } ?> \ No newline at end of file