]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
helper static method to get title text based on a notice
authorEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 18:35:16 +0000 (11:35 -0700)
committerEvan Prodromou <evan@status.net>
Fri, 13 Aug 2010 18:35:16 +0000 (11:35 -0700)
plugins/NoticeTitle/Notice_title.php

index 44d56b49687606a2541fb6fc35e1372ce943161e..c2d1a83ca4001eb21d6eca69d99675a2609fd7e8 100644 (file)
@@ -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;
+        }
+    }
 }