Events for showing the 'tail' of a threaded notice

This commit is contained in:
Evan Prodromou 2011-04-09 16:58:38 -04:00
parent 8aacc4b84a
commit 4d0f42aea2
2 changed files with 49 additions and 22 deletions

View File

@ -1163,3 +1163,23 @@ StartShowGroupProfileBlock: When showing the profile block for a group
EndShowGroupProfileBlock: After showing showing the profile block for a group
- $out: XMLOutputter to append custom output
- $group: the group being shown
StartShowThreadedNoticeTail: when showing the replies etc. to a notice
- $nli: parent noticelistitem
- $notice: parent notice
- &$children: list of children
EndShowThreadedNoticeTail: when showing the replies etc. to a notice
- $nli: parent noticelistitem
- $notice: parent notice
- $children: list of children
StartShowThreadedNoticeSub: when showing a reply to a notice
- $nli: parent noticelistitem
- $parent: parent notice
- $child: child notice
EndShowThreadedNoticeSub: when showing a reply to a notice
- $nli: parent noticelistitem
- $parent: parent notice
- $child: child notice

View File

@ -185,6 +185,7 @@ class ThreadedNoticeListItem extends NoticeListItem
$notices[] = clone($notice); // *grumble* inefficient as hell
}
if (Event::handle('StartShowThreadedNoticeTail', array($this, $this->notice, &$notices))) {
$this->out->elementStart('ul', 'notices threaded-replies xoxo');
$item = new ThreadedNoticeListFavesItem($this->notice, $this->out);
@ -199,10 +200,14 @@ class ThreadedNoticeListItem extends NoticeListItem
$item->show();
}
foreach (array_reverse($notices) as $notice) {
if (Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice))) {
$item = new ThreadedNoticeListSubItem($notice, $this->out);
$item->show();
Event::handle('StartShowThreadedNoticeSub', array($this, $this->notice, $notice));
}
}
}
if ($notices || $hasFaves || $hasRepeats) {
// @fixme do a proper can-post check that's consistent
// with the JS side
@ -212,6 +217,8 @@ class ThreadedNoticeListItem extends NoticeListItem
}
}
$this->out->elementEnd('ul');
Event::handle('EndShowThreadedNoticeTail', array($this, $this->notice, $notices));
}
}
parent::showEnd();