Create renderPortals() function for MonoBook (same interface as Vector one).
authorPlatonides <platonides@users.mediawiki.org>
Wed, 29 Jun 2011 17:11:38 +0000 (17:11 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Wed, 29 Jun 2011 17:11:38 +0000 (17:11 +0000)
Changed Modern to call that function instead of duplicating the code with Modern.

skins/Modern.php
skins/MonoBook.php

index da902d1..9b85064 100644 (file)
@@ -100,24 +100,7 @@ class ModernTemplate extends MonoBookTemplate {
        <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
 
        <!-- portlets -->
-       <?php
-               $sidebar = $this->data['sidebar'];
-               if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
-               if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
-               if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
-
-               foreach ($sidebar as $boxName => $cont) {
-                       if ( $boxName == 'SEARCH' ) {
-                               $this->searchBox();
-                       } elseif ( $boxName == 'TOOLBOX' ) {
-                               $this->toolbox();
-                       } elseif ( $boxName == 'LANGUAGES' ) {
-                               $this->languageBox();
-                       } else {
-                               $this->customBox( $boxName, $cont );
-                       }
-               }
-       ?>
+       <?php $this->renderPortals( $this->data['sidebar'] ); ?>
 
        </div><!-- mw_portlets -->
 
index a766e94..61e086d 100644 (file)
@@ -126,21 +126,7 @@ class MonoBookTemplate extends BaseTemplate {
        </div>
        <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
 <?php
-               $sidebar = $this->data['sidebar'];
-               if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
-               if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
-               if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
-               foreach ($sidebar as $boxName => $cont) {
-                       if ( $boxName == 'SEARCH' ) {
-                               $this->searchBox();
-                       } elseif ( $boxName == 'TOOLBOX' ) {
-                               $this->toolbox();
-                       } elseif ( $boxName == 'LANGUAGES' ) {
-                               $this->languageBox();
-                       } else {
-                               $this->customBox( $boxName, $cont );
-                       }
-               }
+       $this->renderPortals( $this->data['sidebar'] );
 ?>
 </div><!-- end of the left (by default at least) column -->
 <div class="visualClear"></div>
@@ -187,6 +173,25 @@ echo $footerEnd;
        } // end of execute() method
 
        /*************************************************************************************************/
+
+       protected function renderPortals( $sidebar ) {
+               if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
+               if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
+               if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
+
+               foreach ($sidebar as $boxName => $cont) {
+                       if ( $boxName == 'SEARCH' ) {
+                               $this->searchBox();
+                       } elseif ( $boxName == 'TOOLBOX' ) {
+                               $this->toolbox();
+                       } elseif ( $boxName == 'LANGUAGES' ) {
+                               $this->languageBox();
+                       } else {
+                               $this->customBox( $boxName, $cont );
+                       }
+               }
+       }
+
        function searchBox() {
                global $wgUseTwoButtonsSearchForm;
 ?>