handle deletion of notice
This commit is contained in:
parent
6d89aa0931
commit
401cf36de3
@ -137,7 +137,9 @@ class NoticeTitlePlugin extends Plugin
|
|||||||
|
|
||||||
function onStartShowNoticeFormData($form)
|
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',
|
$form->out->element('input', array('type' => 'text',
|
||||||
'id' => 'notice_title',
|
'id' => 'notice_title',
|
||||||
'name' => 'notice_title',
|
'name' => 'notice_title',
|
||||||
@ -257,5 +259,24 @@ class NoticeTitlePlugin extends Plugin
|
|||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user