2014-09-08 06:54:54 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-07-29 13:41:30 +00:00
|
|
|
* ResourceLoader module for the 'ext.visualEditor.desktopArticleTarget.init'
|
2014-09-08 06:54:54 +00:00
|
|
|
* module. Necessary to incorporate the VisualEditorTabMessages
|
|
|
|
* configuration setting.
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
2018-01-03 00:54:47 +00:00
|
|
|
* @copyright 2011-2018 VisualEditor Team and others; see AUTHORS.txt
|
2018-03-28 19:47:04 +00:00
|
|
|
* @license MIT
|
2014-09-08 06:54:54 +00:00
|
|
|
*/
|
|
|
|
|
2015-07-29 13:41:30 +00:00
|
|
|
class VisualEditorDesktopArticleTargetInitModule extends ResourceLoaderFileModule {
|
2014-09-08 06:54:54 +00:00
|
|
|
|
2018-03-28 19:47:04 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2018-10-13 01:01:36 +00:00
|
|
|
public function getMessages() {
|
|
|
|
$messages = parent::getMessages();
|
|
|
|
|
2014-09-08 06:54:54 +00:00
|
|
|
$veConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' );
|
2018-10-13 01:01:36 +00:00
|
|
|
$messages = array_merge(
|
|
|
|
$messages,
|
2014-09-08 06:54:54 +00:00
|
|
|
array_filter( $veConfig->get( 'VisualEditorTabMessages' ) )
|
|
|
|
);
|
|
|
|
|
2018-10-13 01:01:36 +00:00
|
|
|
// 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;
|
2014-09-08 06:54:54 +00:00
|
|
|
}
|
2018-10-13 01:01:36 +00:00
|
|
|
|
2014-09-08 06:54:54 +00:00
|
|
|
}
|