diff --git a/extension.json b/extension.json index 40c1c3de..26f30f38 100644 --- a/extension.json +++ b/extension.json @@ -280,7 +280,8 @@ "Hooks": { "EditPage::showEditForm:initial": "main", "EditPage::showReadOnlyForm:initial": "main", - "GetPreferences": "main" + "GetPreferences": "main", + "ResourceLoaderGetConfigVars": "main" }, "HookHandlers": { "main": { diff --git a/includes/Hooks.php b/includes/Hooks.php index 1f70dbff..21bd7593 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -11,6 +11,7 @@ use MediaWiki\Hook\EditPage__showEditForm_initialHook; use MediaWiki\Hook\EditPage__showReadOnlyForm_initialHook; use MediaWiki\Output\OutputPage; use MediaWiki\Preferences\Hook\GetPreferencesHook; +use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook; use MediaWiki\User\Options\UserOptionsLookup; use MediaWiki\User\User; @@ -20,6 +21,7 @@ use MediaWiki\User\User; class Hooks implements EditPage__showEditForm_initialHook, EditPage__showReadOnlyForm_initialHook, + ResourceLoaderGetConfigVarsHook, GetPreferencesHook { @@ -141,6 +143,20 @@ class Hooks implements return $this->useV6 || $out->getRequest()->getRawVal( 'cm6enable' ); } + /** + * Hook handler for enabling bracket matching. + * + * TODO: Remove after migration to CodeMirror 6 is complete. + * + * @param array &$vars Array of variables to be added into the output of the startup module + * @param string $skin + * @param Config $config + * @return void This hook must not abort, it must return no value + */ + public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void { + $vars['wgCodeMirrorLineNumberingNamespaces'] = $config->get( 'CodeMirrorLineNumberingNamespaces' ); + } + /** * GetPreferences hook handler *