mediawiki-extensions-Discus.../includes/Hooks/MobileHooks.php
Bartosz Dziewoński 99b757465a Split DiscussionToolsEnableMobile=true into 'behind-overlay' and 'remove-overlay'
Bug: T295490
Bug: T295491
Bug: T280051
Change-Id: I1b96b0a22eec9e364c2ecbe8b734cebd0d157b96
2021-11-10 22:24:07 +01:00

34 lines
820 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' ) !== 'remove-overlay' ) {
return true;
}
if ( HookUtils::isFeatureEnabledForOutput( $output ) ) {
return false;
}
return true;
}
}