From: Evan Prodromou Date: Sat, 14 Aug 2010 18:58:54 +0000 (-0700) Subject: handle deletion of notice X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=401cf36de3bcce681f95344cc479f0594014b028;p=quix0rs-gnu-social.git handle deletion of notice --- diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php index 18ffed4be2..f7fb1e4d00 100644 --- a/plugins/NoticeTitle/NoticeTitlePlugin.php +++ b/plugins/NoticeTitle/NoticeTitlePlugin.php @@ -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; + } }