From: Tpt Date: Fri, 9 May 2014 11:57:16 +0000 (+0200) Subject: Adds the SidebarBeforeOutput hook X-Git-Tag: 1.31.0-rc.0~15781^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=0c6c03050cfd6b90b90eb83fed021d8eaf16de2b;p=lhc%2Fweb%2Fwiklou.git Adds the SidebarBeforeOutput hook Allows to modify sidebar abstract representation just before its output Required by change Ib4014253016db1c3d6b624be9ebbdaf452115145 Change-Id: I170e7253825c8dab5cad38e6b0ba59f28572efbf --- diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 189c5f1fd2..3b7583b34e 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -19,6 +19,8 @@ production. * HTMLForm now supports multiple copies of an input field or set of input fields, e.g. the form may request "one or more usernames" without having to have the user enter delimited list of names into a text field. +* Added a new hook, "SidebarBeforeOutput", to allow to edit the structure of + the sidebar just before its display. === Bug fixes in 1.24 === * (bug 62258) A bug was fixed in File::getUnscaledThumb when a height diff --git a/docs/hooks.txt b/docs/hooks.txt index 688e0cd91b..333f878b7b 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2226,6 +2226,12 @@ $skin: Skin object &$bar: Sidebar contents Modify $bar to add or modify sidebar portlets. +'SidebarBeforeOutput': Allows to edit sidebar just before its output by skins. +$skin Skin object +&$bar: Sidebar content +Modify $bar to add or modify sidebar portlets. +Warning: This hook is run on each display. You should consider to use 'SkinBuildSidebar' that is aggressively cached. + 'SkinCopyrightFooter': Allow for site and per-namespace customization of copyright notice. $title: displayed page title diff --git a/includes/Skin.php b/includes/Skin.php index 8300da784a..cfa059efd9 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1244,6 +1244,8 @@ abstract class Skin extends ContextSource { if ( $wgEnableSidebarCache ) { $cachedsidebar = $wgMemc->get( $key ); if ( $cachedsidebar ) { + wfRunHooks( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) ); + wfProfileOut( __METHOD__ ); return $cachedsidebar; } @@ -1257,6 +1259,8 @@ abstract class Skin extends ContextSource { $wgMemc->set( $key, $bar, $wgSidebarCacheExpiry ); } + wfRunHooks( 'SidebarBeforeOutput', array( $this, &$bar ) ); + wfProfileOut( __METHOD__ ); return $bar; }