mediawiki-extensions-Visual.../includes/VisualEditorDesktopArticleTargetInitModule.php
James D. Forrester 3c293ea00c doc: Bump copyright year for 2019
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
2019-01-01 13:24:23 +00:00

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;
}
}