Add support for icons not prefixed with `wikimedia-`.

Needed for I0226892b2047e55d336c085c173e04a6fb4ecfa5

Bug: T257143
Change-Id: Ia24ac074aea329293c443c772229a0d5ac7246f9
This commit is contained in:
Jon Robson 2022-03-04 14:11:56 -08:00 committed by Jdlrobson
parent fc11a4dc46
commit 35721398b2
1 changed files with 11 additions and 2 deletions

View File

@ -203,7 +203,13 @@ class Hooks {
*/
private static function addIconToListItem( &$item, $icon_name ) {
// Set the default menu icon classes.
$menu_icon_classes = [ 'mw-ui-icon', 'mw-ui-icon-before', 'mw-ui-icon-wikimedia-' . $icon_name ];
$menu_icon_classes = [ 'mw-ui-icon', 'mw-ui-icon-before',
// Some extensions declare icons without the wikimedia- prefix. e.g. Echo
'mw-ui-icon-' . $icon_name,
// FIXME: Some icon names are prefixed with `wikimedia-`.
// We should seek to remove all these instances.
'mw-ui-icon-wikimedia-' . $icon_name
];
self::addListItemClass( $item, $menu_icon_classes, true );
}
@ -337,7 +343,10 @@ class Hooks {
if ( $icon ) {
if ( $hideText ) {
$item['link-class'][] = 'mw-ui-icon mw-ui-icon-element mw-ui-icon-wikimedia-' . $icon;
$item['link-class'][] = 'mw-ui-icon mw-ui-icon-element'
. ' mw-ui-icon-wikimedia-' . $icon
// Some extensions declare icons without the wikimedia- prefix. e.g. Echo
. ' mw-ui-icon-' . $icon;
} else {
$item['link-html'] = self::makeIcon( $icon );
}