Manual talk:Hooks/ResourceLoaderGetConfigVars
Add topicAppearance
Latest comment: 7 years ago by Gabriel Birke (WMDE) in topic Remove global variables from the example
| This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
Remove global variables from the example
[edit]The same result as in the example, but without using the global keyword:
class VisualEditorHooks {
public static function onResourceLoaderGetConfigVars( array &$vars ) {
$config = MediaWikiServices::getInstance()->getMainConfig();
$vars['wgVisualEditor'] = [
'disableForAnons' => $config->get( 'VisualEditorDisableForAnons' ),
'enableExperimentalCode' => $config->get( 'VisualEditorEnableExperimentalCode '),
];
return true;
}
}
This would get rid of the global variables, which might be deprecated in the future. Gabriel Birke (WMDE) (talk) 16:41, 28 February 2018 (UTC)