* It is recommended that skins wishing to override call parent::getDefaultModules()
* and substitute out any modules they wish to change by using a key to look them up
*
- * For style modules, use setupSkinUserCss() instead.
+ * Any modules defined with the 'styles' key will be added as render blocking CSS via
+ * Output::addModuleStyles. Similarly, each key should refer to a list of modules
*
* @return array Array of modules with helper keys for easy overriding
*/
public function getDefaultModules() {
- global $wgUseAjax;
-
$out = $this->getOutput();
$config = $this->getConfig();
$user = $out->getUser();
$modules = [
+ // Styles key sets render blocking styles
+ // Unlike other keys in this definition it is an associative array
+ // where each key is the group name and points to a list of modules
+ 'styles' => [],
// modules not specific to any specific skin or page
'core' => [
// Enforce various default modules for all pages and all skins
}
// Add various resources if required
- if ( $wgUseAjax ) {
- if ( $user->isLoggedIn()
- && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' )
- && $this->getRelevantTitle()->canExist()
- ) {
- $modules['watch'][] = 'mediawiki.page.watch.ajax';
- }
-
- $modules['search'][] = 'mediawiki.searchSuggest';
+ if ( $user->isLoggedIn()
+ && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' )
+ && $this->getRelevantTitle()->canExist()
+ ) {
+ $modules['watch'][] = 'mediawiki.page.watch.ajax';
}
+ $modules['search'][] = 'mediawiki.searchSuggest';
+
if ( $user->getBoolOption( 'editsectiononrightclick' ) ) {
$modules['user'][] = 'mediawiki.action.view.rightClickEdit';
}