mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
Change icon for supported skins when both VE and source edit icons are present
This introduces an extension attribute EditIconSkins which allows extensions or skins to request the rendering of edit icons. This will be used by Minerva in I3c9d59f49f1b939981a7b2b450448db6736d5958 Bug: T346944 Change-Id: I401805224c0f387ac85b52b50c1f298b83c03a91
This commit is contained in:
parent
9ce1a1d44e
commit
47815e9d2b
|
@ -607,6 +607,14 @@ class Hooks implements
|
|||
$newViews = [];
|
||||
$wikiPageFactory = $services->getWikiPageFactory();
|
||||
$isRemote = !$wikiPageFactory->newFromTitle( $title )->isLocal();
|
||||
|
||||
$skinHasEditIcons = in_array(
|
||||
$skin->getSkinName(),
|
||||
ExtensionRegistry::getInstance()->getAttribute(
|
||||
'VisualEditorIconSkins'
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $links['views'] as $action => $data ) {
|
||||
if ( $action === 'edit' ) {
|
||||
// Build the VisualEditor tab
|
||||
|
@ -639,6 +647,7 @@ class Hooks implements
|
|||
'text' => $veTabText,
|
||||
'single-id' => $veTooltip,
|
||||
'primary' => true,
|
||||
'icon' => $skinHasEditIcons ? 'edit' : null,
|
||||
'class' => '',
|
||||
];
|
||||
|
||||
|
@ -690,6 +699,8 @@ class Hooks implements
|
|||
$userOptionsLookup->getOption( $user, 'visualeditor-tabs' ) === 'multi-tab'
|
||||
)
|
||||
) {
|
||||
// Change icon
|
||||
$editTab['icon'] = $skinHasEditIcons ? 'wikiText' : null;
|
||||
// Inject the VE tab before or after the edit tab
|
||||
if ( $config->get( 'VisualEditorTabPosition' ) === 'before' ) {
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
|
|
Loading…
Reference in a new issue