From 35721398b23ef1c32c9f157621fdb1d7d72c63a2 Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Fri, 4 Mar 2022 14:11:56 -0800 Subject: [PATCH] Add support for icons not prefixed with `wikimedia-`. Needed for I0226892b2047e55d336c085c173e04a6fb4ecfa5 Bug: T257143 Change-Id: Ia24ac074aea329293c443c772229a0d5ac7246f9 --- includes/Hooks.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index dc12e08c0..c9a2dfcd0 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -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 ); }