handle deletion of notice

This commit is contained in:
Evan Prodromou 2010-08-14 11:58:54 -07:00
parent 6d89aa0931
commit 401cf36de3

View File

@ -137,7 +137,9 @@ class NoticeTitlePlugin extends Plugin
function onStartShowNoticeFormData($form)
{
$form->out->element('style', null, 'label#notice_data-text-label { display: none }');
$form->out->element('style',
null,
'label#notice_data-text-label { display: none }');
$form->out->element('input', array('type' => 'text',
'id' => 'notice_title',
'name' => 'notice_title',
@ -257,5 +259,24 @@ class NoticeTitlePlugin extends Plugin
return true;
}
/**
* Remove title when the notice is deleted
*
* @param Notice $notice Notice being deleted
*
* @return boolean hook value
*/
function onNoticeDeleteRelated($notice)
{
$nt = Notice_title::staticGet('notice_id', $notice->id);
if (!empty($nt)) {
$nt->delete();
}
return true;
}
}