73 foreach ( $vars
as $key =>
$value ) {
74 $this->config[$key] =
$value;
115 $this->exemptStates = $states;
157 foreach ( $this->modules
as $name ) {
158 $module = $rl->getModule( $name );
163 $group = $module->getGroup();
164 $position = $module->getPosition();
166 if ( $group ===
'private' ) {
168 $data[
'embed'][
'general'][$position][] =
$name;
177 foreach ( $this->moduleStyles
as $name ) {
178 $module = $rl->getModule( $name );
184 $logger = $rl->getLogger();
185 $logger->debug(
'Unexpected general module "{module}" in styles queue.', [
194 $group = $module->getGroup();
196 if ( $module->isKnownEmpty(
$context ) ) {
200 if ( $group ===
'private' ) {
212 foreach ( $this->moduleScripts
as $name ) {
213 $module = $rl->getModule( $name );
218 $group = $module->getGroup();
219 $position = $module->getPosition();
221 if ( $module->isKnownEmpty(
$context ) ) {
240 return [
'class' =>
'client-nojs' ];
265 'document.documentElement.className = document.documentElement.className'
266 .
'.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );'
270 if ( $this->config ) {
277 $states = array_merge( $this->exemptStates,
$data[
'states'] );
285 if (
$data[
'embed'][
'general'][
'top'] ) {
287 $data[
'embed'][
'general'][
'top'],
293 if (
$data[
'general'][
'top'] ) {
300 if (
$data[
'scripts'][
'top'] ) {
302 $data[
'scripts'][
'top'],
308 if (
$data[
'styles'] ) {
316 if (
$data[
'embed'][
'styles'] ) {
318 $data[
'embed'][
'styles'],
325 $startupQuery = $this->target ? [
'target' =>
$this->target ] : [];
332 return WrappedStringList::join(
"\n", $chunks );
343 if (
$data[
'embed'][
'general'][
'bottom'] ) {
345 $data[
'embed'][
'general'][
'bottom'],
351 if (
$data[
'scripts'][
'bottom'] ) {
353 $data[
'scripts'][
'bottom'],
359 if (
$data[
'general'][
'bottom'] ) {
365 return WrappedStringList::join(
"\n", $chunks );
369 return self::makeContext( $this->context, $group,
$type );
373 return self::makeLoad( $this->context, (
array)
$modules, $only, $extraQuery );
377 array $extraQuery = []
384 if ( $group !==
'user' && $group !==
'private' ) {
385 $req->setVal(
'user', null );
402 array $extraQuery = []
407 if ( $mainContext->
getDebug() && count( $modules ) > 1 ) {
410 foreach ( $modules
as $name ) {
411 $chunks[] = self::makeLoad( $mainContext, [ $name ], $only, $extraQuery );
413 return new WrappedStringList(
"\n", $chunks );
420 foreach ( $modules
as $name ) {
421 $module = $rl->getModule( $name );
423 $rl->getLogger()->warning(
'Unknown module "{module}"', [
'module' => $name ] );
426 $sortedModules[$module->getSource()][$module->getGroup()][
$name] = $module;
429 foreach ( $sortedModules
as $source => $groups ) {
430 foreach ( $groups
as $group => $grpModules ) {
431 $context = self::makeContext( $mainContext, $group, $only, $extraQuery );
432 $context->setModules( array_keys( $grpModules ) );
434 if ( $group ===
'private' ) {
438 $rl->makeModuleResponse(
$context, $grpModules )
442 $rl->makeModuleResponse(
$context, $grpModules )
450 foreach ( $grpModules
as $key => $module ) {
451 $isRaw |= $module->isRaw();
459 if ( $group ===
'user' ) {
473 'async' => !isset( $extraQuery[
'sync'] ),
483 if ( $group ==
'noscript' ) {
491 return new WrappedStringList(
"\n", $chunks );
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
setConfig(array $vars)
Set mw.config variables.
static inlineScript($contents)
Output a "