mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
3c293ea00c
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* ResourceLoader module for the 'ext.visualEditor.desktopArticleTarget.init'
|
|
* module. Necessary to incorporate the VisualEditorTabMessages
|
|
* configuration setting.
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @copyright 2011-2019 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
|
|
class VisualEditorDesktopArticleTargetInitModule extends ResourceLoaderFileModule {
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getMessages() {
|
|
$messages = parent::getMessages();
|
|
|
|
$veConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' );
|
|
$messages = array_merge(
|
|
$messages,
|
|
array_filter( $veConfig->get( 'VisualEditorTabMessages' ) )
|
|
);
|
|
|
|
// Skin-dependent messages for the edit tab (same as generated by SkinTemplate).
|
|
// We only need the message for the current skin, but we don't know which skin will be used.
|
|
// Only some skins use these (e.g. Vector), others just use default 'edit' and 'create'.
|
|
foreach ( SkinFactory::getDefaultInstance()->getSkinNames() as $skname => $unused ) {
|
|
foreach ( [ 'edit', 'create' ] as $msgKey ) {
|
|
// e.g. vector-view-edit, vector-view-create
|
|
if ( wfMessage( "$skname-view-$msgKey" )->inContentLanguage()->exists() ) {
|
|
$messages[] = "$skname-view-$msgKey";
|
|
}
|
|
}
|
|
}
|
|
|
|
return $messages;
|
|
}
|
|
|
|
}
|