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: * *
    *
  1. * The output is being rendered with the * SkinMinervaBeta skin, i.e. the user is currently * viewing the page on the mobile set in beta mode *
  2. *
  3. The page is in mainspace
  4. *
* * @param OutputPage $out * @param Skin $skin * @return boolean Always 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; } }