diff options
author | Evan Prodromou <evan@status.net> | 2010-08-13 11:35:16 -0700 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-08-13 11:35:16 -0700 |
commit | 67ff9ea49011fd8cc1c102c6fb236c47cd034342 (patch) | |
tree | 7b02e510da220d1c52e7020a9c8f863ba74833ba | |
parent | e2128b201952131ab78344b089b72a0b74521c86 (diff) |
helper static method to get title text based on a notice
-rw-r--r-- | plugins/NoticeTitle/Notice_title.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/NoticeTitle/Notice_title.php b/plugins/NoticeTitle/Notice_title.php index 44d56b496..c2d1a83ca 100644 --- a/plugins/NoticeTitle/Notice_title.php +++ b/plugins/NoticeTitle/Notice_title.php @@ -115,4 +115,22 @@ class Notice_title extends Memcached_DataObject { return array(false, false, false); } + + /** + * Get a notice title based on the notice + * + * @param Notice $notice Notice to fetch a title for + * + * @return string title of the notice, or null if none + */ + + static function fromNotice(Notice $notice) + { + $nt = Notice_title::staticGet('notice_id', $notice->id); + if (empty($nt)) { + return null; + } else { + return $nt->title; + } + } } |