add hooks to the feedlist widget to give fine-grained control over feed links

This commit is contained in:
Evan Prodromou 2010-09-29 19:23:46 +02:00
parent 3839627a6f
commit d2ef0cf233
2 changed files with 53 additions and 29 deletions

View File

@ -1086,3 +1086,19 @@ StartDeleteOwnNotice: when a user starts to delete their own notice
EndDeleteOwnNotice: when a user has deleted their own notice
- $user: the user doing the delete
- $notice: the notice being deleted
StartShowFeedLinkList: before showing the feed list in the sidebar
- $action: action being executed
- $feeds: list of feeds to show
EndShowFeedLinkList: after showing the feed list in the sidebar
- $action: action being executed
- $feeds: list of feeds shown
StartShowFeedLink: before showing an individual feed item
- $action: action being executed
- $feed: feed to show
EndShowFeedLink: after showing an individual feed
- $action: action being executed
- $feed: feed to show

View File

@ -59,6 +59,8 @@ class FeedList extends Widget
function show($feeds)
{
if (Event::handle('StartShowFeedLinkList', array($this->action, &$feeds))) {
if (!empty($feeds)) {
$this->out->elementStart('div', array('id' => 'export_data',
'class' => 'section'));
$this->out->element('h2', null, _('Feeds'));
@ -71,9 +73,13 @@ class FeedList extends Widget
$this->out->elementEnd('ul');
$this->out->elementEnd('div');
}
Event::handle('EndShowFeedLinkList', array($this->action, &$feeds));
}
}
function feedItem($feed)
{
if (Event::handle('StartShowFeedLink', array($this->action, &$feed))) {
$classname = null;
switch ($feed->type) {
@ -96,5 +102,7 @@ class FeedList extends Widget
'title' => $feed->title),
$feed->typeName());
$this->out->elementEnd('li');
Event::handle('EndShowFeedLink', array($this->action, $feed));
}
}
}