mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
e048c3e188
Bug: T206892 Change-Id: If9494be10c684c1d8892a990dd7ba9c68caa4b69
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-2018 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;
|
|
}
|
|
|
|
}
|