MakeGlobalVariablesScript hook.
*
* Sets the value of the wgRelatedArticles
global variable
* to the list of related articles in the cached parser output.
*
* @param array $vars
* @param OutputPage $out
* @return boolean Always true
*/
public static function onMakeGlobalVariablesScript( &$vars, OutputPage $out ) {
$vars['wgRelatedArticles'] = $out->getProperty( 'RelatedArticles' );
return true;
}
/**
* Handler for the BeforePageDisplay
hook.
*
* Adds the ext.relatedArticles.readMore.bootstrap
module
* to the output when:
*
*
SkinMinervaBeta skin, i.e. the user is currently
* viewing the page on the mobile set in beta mode
*
true
*/
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
$title = $out->getContext()->getTitle();
if (
get_class( $skin ) === 'SkinMinervaBeta' &&
$title->inNamespace( NS_MAIN ) &&
!$title->isMainPage()
) {
$out->addModules( array( 'ext.relatedArticles.readMore.bootstrap' ) );
}
return true;
}
}