Make adding sidebar elements easier for extensions (e.g. Extension:GroupsSidebar)
authorTobias <churchofemacs@users.mediawiki.org>
Wed, 18 Nov 2009 21:06:54 +0000 (21:06 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Wed, 18 Nov 2009 21:06:54 +0000 (21:06 +0000)
includes/Skin.php

index 17da161..2002613 100644 (file)
@@ -2044,7 +2044,22 @@ END;
                }
 
                $bar = array();
-               $lines = explode( "\n", wfMsgForContent( 'sidebar' ) );
+               $this->addToSidebar( &$bar, 'sidebar' );
+
+               wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) );
+               if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
+               wfProfileOut( __METHOD__ );
+               return $bar;
+       }
+       /**
+        * Add content from a sidebar system message
+        * Currently only used for MediaWiki:Sidebar (but may be used by Extensions)
+        * 
+        * @param &$bar array
+        * @param $message String
+        */
+       function addToSidebar( &$bar, $message ) {
+               $lines = explode( "\n", wfMsgForContent( $message ) );
                $heading = '';
                foreach( $lines as $line ) {
                        if( strpos( $line, '*' ) !== 0 )
@@ -2086,10 +2101,6 @@ END;
                                } else { continue; }
                        }
                }
-               wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) );
-               if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
-               wfProfileOut( __METHOD__ );
-               return $bar;
        }
 
        /**