diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-06-12 17:06:42 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-06-12 17:06:42 -0700 |
commit | 89d0583b91a237448b9f7ea3b0ae303072631447 (patch) | |
tree | 20b4d087d488a0d694993ab29e46b5e0c27820b9 | |
parent | 79fa050125971625229a586f1ffed1a0ea504510 (diff) |
Fixes Ticket #1607 - empty 'page-notice' definition lists were
being output in a bunch of places.
-rw-r--r-- | lib/action.php | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/action.php b/lib/action.php index 7643e5afb..89a8c8f4d 100644 --- a/lib/action.php +++ b/lib/action.php @@ -575,20 +575,32 @@ class Action extends HTMLOutputter // lawsuit /** * Show page notice block. * + * Only show the block if a subclassed action has overrided + * Action::showPageNotice(), or an event handler is registered for + * the StartShowPageNotice event, in which case we assume the + * 'page_notice' definition list is desired. This is to prevent + * empty 'page_notice' definition lists from being output everywhere. + * * @return nothing */ function showPageNoticeBlock() { - $this->elementStart('dl', array('id' => 'page_notice', - 'class' => 'system_notice')); - $this->element('dt', null, _('Page notice')); - $this->elementStart('dd'); - if (Event::handle('StartShowPageNotice', array($this))) { - $this->showPageNotice(); - Event::handle('EndShowPageNotice', array($this)); + $rmethod = new ReflectionMethod($this, 'showPageNotice'); + $dclass = $rmethod->getDeclaringClass()->getName(); + + if ($dclass != 'Action' || Event::hasHandler('StartShowPageNotice')) { + + $this->elementStart('dl', array('id' => 'page_notice', + 'class' => 'system_notice')); + $this->element('dt', null, _('Page notice')); + $this->elementStart('dd'); + if (Event::handle('StartShowPageNotice', array($this))) { + $this->showPageNotice(); + Event::handle('EndShowPageNotice', array($this)); + } + $this->elementEnd('dd'); + $this->elementEnd('dl'); } - $this->elementEnd('dd'); - $this->elementEnd('dl'); } /** |