summaryrefslogtreecommitdiff
path: root/plugins/NoticeTitle/NoticeTitlePlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-08-14 11:58:54 -0700
committerEvan Prodromou <evan@status.net>2010-08-14 11:58:54 -0700
commit401cf36de3bcce681f95344cc479f0594014b028 (patch)
treec1c7ad106874895dfb2df4eecbb527573c06e702 /plugins/NoticeTitle/NoticeTitlePlugin.php
parent6d89aa09317719dd4f682f75a10e8e9b50132b5c (diff)
handle deletion of notice
Diffstat (limited to 'plugins/NoticeTitle/NoticeTitlePlugin.php')
-rw-r--r--plugins/NoticeTitle/NoticeTitlePlugin.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/NoticeTitle/NoticeTitlePlugin.php b/plugins/NoticeTitle/NoticeTitlePlugin.php
index 18ffed4be..f7fb1e4d0 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;
+ }
}