mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-12 00:59:46 +00:00
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:
parent
e2b13a00d1
commit
323acda0b1
|
@ -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' );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue