Disable related articles on disambiguation pages

Uses DisambiguatorHooks to prevent related pages module addition on
disambiguation pages.

Bug: T127068
Change-Id: I166712d7e5df26ad00c725f3e4fe23ec074b3329
This commit is contained in:
Sumit Asthana 2016-08-24 04:08:44 +05:30
parent 505f865f2e
commit cea66f6cda

View file

@ -8,6 +8,7 @@ use ResourceLoader;
use Skin; use Skin;
use ConfigFactory; use ConfigFactory;
use User; use User;
use DisambiguatorHooks;
class FooterHooks { class FooterHooks {
@ -52,6 +53,10 @@ class FooterHooks {
* @return boolean Always <code>true</code> * @return boolean Always <code>true</code>
*/ */
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) { public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
if ( class_exists( 'DisambiguatorHooks' ) &&
DisambiguatorHooks::isDisambiguationPage( $out->getTitle() ) ) {
return true;
}
$config = ConfigFactory::getDefaultInstance()->makeConfig( 'RelatedArticles' ); $config = ConfigFactory::getDefaultInstance()->makeConfig( 'RelatedArticles' );
$showReadMore = $config->get( 'RelatedArticlesShowInFooter' ); $showReadMore = $config->get( 'RelatedArticlesShowInFooter' );