]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/noticelistitem.php
section control over their notice lists + HTML id stuff
[quix0rs-gnu-social.git] / lib / noticelistitem.php
index be55c522c8b4543ab832457b5961bae668c419cf..4a50f548cb00fc0de53e48416d6817d842fbfa58 100644 (file)
@@ -60,6 +60,7 @@ class NoticeListItem extends Widget
 
     protected $addressees = true;
     protected $attachments = true;
+    protected $id_prefix = null;
     protected $options = true;
     protected $maxchars = 0;   // if <= 0 it means use full posts
 
@@ -99,6 +100,12 @@ class NoticeListItem extends Widget
                 $this->$key = (bool)$prefs[$key];
             }
         }
+        // string preferences
+        foreach(array('id_prefix') as $key) {
+            if (array_key_exists($key, $prefs)) {
+                $this->$key = $prefs[$key];
+            }
+        }
     }
 
     /**
@@ -211,8 +218,9 @@ class NoticeListItem extends Widget
             if (!empty($this->notice->source)) {
                 $class .= ' notice-source-'.$this->notice->source;
             }
+            $id_prefix = (strlen($this->id_prefix) ? $this->id_prefix . '-' : '');
             $this->out->elementStart('li', array('class' => $class,
-                                                 'id' => 'notice-' . $id));
+                                                 'id' => "${id_prefix}notice-${id}"));
             Event::handle('EndOpenNoticeListItemElement', array($this));
         }
     }