Fix safe mode warning message

Use OOUI FieldLayout to display the warning properly.

Bug: T376850
Change-Id: I1755dd8b1c7428d6e6468ec1f5e08bd7aabb77e2
This commit is contained in:
Ammarpad 2024-10-31 08:47:52 +01:00
parent 1d38fe185d
commit 5974d068bd

View file

@ -51,7 +51,9 @@ use MediaWiki\Title\TitleValue;
use MediaWiki\User\Hook\UserGetDefaultOptionsHook; use MediaWiki\User\Hook\UserGetDefaultOptionsHook;
use MediaWiki\User\Options\UserOptionsLookup; use MediaWiki\User\Options\UserOptionsLookup;
use MediaWiki\User\User; use MediaWiki\User\User;
use OOUI\FieldLayout;
use OOUI\HtmlSnippet; use OOUI\HtmlSnippet;
use OOUI\MessageWidget;
use Skin; use Skin;
use Wikimedia\Message\MessageSpecifier; use Wikimedia\Message\MessageSpecifier;
use Wikimedia\Rdbms\IExpression; use Wikimedia\Rdbms\IExpression;
@ -176,9 +178,15 @@ class Hooks implements
if ( $safeMode ) { if ( $safeMode ) {
$preferences['gadgets-safemode'] = [ $preferences['gadgets-safemode'] = [
'type' => 'info', 'type' => 'info',
'default' => Html::warningBox( wfMessage( 'gadgets-prefstext-safemode' )->parse() ),
'section' => 'gadgets', 'section' => 'gadgets',
'raw' => true, 'raw' => true,
'rawrow' => true,
'default' => new FieldLayout(
new MessageWidget( [
'label' => new HtmlSnippet( wfMessage( 'gadgets-prefstext-safemode' )->parse() ),
'type' => 'warning',
] )
),
]; ];
} }