diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php index 87c834d9ba..8ee29baddf 100644 --- a/VisualEditor.hooks.php +++ b/VisualEditor.hooks.php @@ -18,17 +18,6 @@ class VisualEditorHooks { // this should have no impact on deploying to Wikimedia's wiki cluster; // is fine for release tarballs because 1.22wmf11 < 1.22alpha < 1.22.0. wfUseMW( '1.24wmf18' ); - - $coreConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); - $veConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'visualeditor' ); - $resourceModules = $coreConfig->get( 'ResourceModules' ); - // Add tab messages to the init init module - foreach ( $veConfig->get( 'VisualEditorTabMessages' ) as $msg ) { - if ( $msg !== null ) { - $resourceModules['ext.visualEditor.viewPageTarget.init']['messages'][] = $msg; - } - } - $coreConfig->set( 'ResourceModules', $resourceModules ); } /** diff --git a/VisualEditor.php b/VisualEditor.php index 964eed24fe..73a9119a51 100644 --- a/VisualEditor.php +++ b/VisualEditor.php @@ -39,6 +39,8 @@ $wgAutoloadClasses['ApiVisualEditor'] = $dir . 'ApiVisualEditor.php'; $wgAutoloadClasses['ApiVisualEditorEdit'] = $dir . 'ApiVisualEditorEdit.php'; $wgAutoloadClasses['VisualEditorHooks'] = $dir . 'VisualEditor.hooks.php'; $wgAutoloadClasses['VisualEditorDataModule'] = $dir . 'VisualEditorDataModule.php'; +$wgAutoloadClasses['VisualEditorViewPageTargetInitModule'] = + $dir . 'VisualEditorViewPageTargetInitModule.php'; $wgExtensionMessagesFiles['VisualEditor'] = $dir . 'VisualEditor.i18n.php'; $wgMessagesDirs['VisualEditor'] = array( __DIR__ . '/lib/ve/i18n', @@ -158,6 +160,7 @@ $wgResourceModules += array( ), 'ext.visualEditor.viewPageTarget.init' => $wgVisualEditorResourceTemplate + array( + 'class' => 'VisualEditorViewPageTargetInitModule', 'scripts' => 'modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js', 'styles' => 'modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.init.css', 'dependencies' => array( diff --git a/VisualEditorViewPageTargetInitModule.php b/VisualEditorViewPageTargetInitModule.php new file mode 100644 index 0000000000..dd744ee13e --- /dev/null +++ b/VisualEditorViewPageTargetInitModule.php @@ -0,0 +1,28 @@ +makeConfig( 'visualeditor' ); + $options['messages'] = array_merge( + $options['messages'], + array_filter( $veConfig->get( 'VisualEditorTabMessages' ) ) + ); + + parent::__construct( $options, $localBasePath, $remoteBasePath ); + } +}