r83532 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83531‎ | r83532 | r83533 >
Date:17:57, 8 March 2011
Author:ialex
Status:deferred (Comments)
Tags:
Comment:
Use the RessourceLoader to load the styles file
Modified paths:
  • /trunk/extensions/BreadCrumbs/BreadCrumbs.php (modified) (history)
  • /trunk/extensions/BreadCrumbs/BreadCrumbsFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BreadCrumbs/BreadCrumbs.php
@@ -33,6 +33,14 @@
3434 'descriptionmsg' => 'breadcrumbs-desc',
3535 );
3636
 37+# Ressource loader
 38+$wgResourceModules['ext.breadCrumbs'] = array(
 39+ 'styles' => 'BreadCrumbs.css',
 40+
 41+ 'localBasePath' => dirname( __FILE__ ),
 42+ 'remoteExtPath' => 'BreadCrumbs'
 43+);
 44+
3745 # Set Hook:
3846
3947 # Showing and updating the breadcrumbs trail
Index: trunk/extensions/BreadCrumbs/BreadCrumbsFunctions.php
@@ -64,15 +64,12 @@
6565
6666 # Entry point for the hook for printing the CSS:
6767 function fnBreadCrumbsOutputHook( &$m_pageObj, $m_parserOutput ) {
68 - global $wgScriptPath, $wgBreadCrumbsShowAnons, $wgUser;
 68+ global $wgBreadCrumbsShowAnons, $wgUser;
6969
70 - if ( !$wgBreadCrumbsShowAnons && $wgUser->isAnon() )
71 - return true;
 70+ if ( $wgBreadCrumbsShowAnons || $wgUser->isLoggedIn() ) {
 71+ $m_pageObj->addModules( 'ext.breadCrumbs' );
 72+ }
7273
73 - # Register CSS file for our select box:
74 - $m_pageObj->addExtensionStyle( $wgScriptPath .
75 - '/extensions/BreadCrumbs/BreadCrumbs.css' );
76 -
7774 # Be nice:
7875 return true;
7976 }

Comments

#Comment by Reedy (talk | contribs)   12:35, 24 March 2011

Status & tagging log