mediawiki-extensions-Discus.../includes/Hooks/MobileHooks.php
David Lynch 7588a393e4 Use MinervaNeue hook to disable talk overlay if DT mobile enabled
Bug: T280051
Change-Id: I6a52adcfd8030b26649b609ca99902ff840e8fdf
2021-11-04 16:46:42 +00:00

34 lines
800 B
PHP

<?php
/**
* DiscussionTools mobile hooks
*
* @file
* @ingroup Extensions
* @license MIT
*/
namespace MediaWiki\Extension\DiscussionTools\Hooks;
use MediaWiki\MediaWikiServices;
class MobileHooks {
/**
* Decide whether mobile frontend should be allowed to activate
*
* @param \Title $title
* @param \OutputPage $output
* @return bool|void This hook can return false to abort, causing the talk overlay to not be shown
*/
public static function onMinervaNeueTalkPageOverlay( $title, $output ) {
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()
->makeConfig( 'discussiontools' );
if ( !$dtConfig->get( 'DiscussionToolsEnableMobile' ) ) {
return true;
}
if ( HookUtils::isFeatureEnabledForOutput( $output ) ) {
return false;
}
return true;
}
}