page = $extra['page']; $this->fields['confirm'] = new Pluf_Form_Field_Boolean( array('required' => true, 'label' => __('Yes, I understand that the page and all its revisions will be deleted.'), 'initial' => '', )); } /** * Check the confirmation. */ public function clean_confirm() { if (!$this->cleaned_data['confirm']) { throw new Pluf_Form_Invalid(__('You need to confirm the deletion.')); } return $this->cleaned_data['confirm']; } function save($commit=true) { if (!$this->isValid()) { throw new Exception(__('Cannot save the model from an invalid form.')); } $this->page->delete(); return true; } }