feat(core): add icon to all talk page buttons

Talk page keys in the associated page array can vary based on namespace.
This commit will match keys end with 'talk' and match them to the speechBubble icon.
This commit is contained in:
alistair3149 2022-12-01 22:33:45 -05:00
parent e2b13a00d1
commit 323acda0b1
No known key found for this signature in database

View file

@ -225,13 +225,18 @@ class SkinHooks implements
// Most icons are not mapped yet in the associated pages menu
$iconMap = [
'main' => 'article',
'user' => 'userAvatar',
'talk' => 'speechBubbles',
'category_talk' => 'speechBubbles',
'image_talk' => 'speechBubbles',
'user_talk' => 'userTalk'
'user' => 'userAvatar'
];
// Special handling for talk pages
// Since talk keys have namespace as prefix
foreach ( $links['associated-pages'] as $key => $item ) {
// I wish I can use str_ends_with but need to wait for PHP 7.X to be dropped
if ( substr( $key, -4 ) === 'talk' ) {
$links['associated-pages'][$key]['icon'] = 'speechBubbles';
}
}
self::mapIconsToMenuItems( $links, 'associated-pages', $iconMap );
self::addIconsToMenuItems( $links, 'associated-pages' );
}