* @file
*/
+use Wikimedia\WrappedString;
use Wikimedia\WrappedStringList;
/**
/**
* Ensure the styles of one or more modules are loaded.
*
- * @deprecated since 1.28
* @param array $modules Array of module names
*/
public function setModuleStyles( array $modules ) {
'general' => [],
],
// Deprecations for style-only modules
- 'styledeprecations' => [],
+ 'styleDeprecations' => [],
];
foreach ( $this->modules as $name ) {
}
$deprecation = $module->getDeprecationInformation();
if ( $deprecation ) {
- $data['styledeprecations'][] = $deprecation;
+ $data['styleDeprecations'][] = $deprecation;
}
}
);
}
- // Deprecations for only=styles modules
- if ( $data['styledeprecations'] ) {
- $chunks[] = ResourceLoader::makeInlineScript(
- implode( '', $data['styledeprecations'] ),
- $nonce
- );
- }
-
// External stylesheets (only=styles)
if ( $data['styles'] ) {
$chunks[] = $this->getLoad(
$startupQuery
);
- return WrappedStringList::join( "\n", $chunks );
+ return WrappedString::join( "\n", $chunks );
}
/**
* @return string|WrappedStringList HTML
*/
public function getBodyHtml() {
- return '';
+ $data = $this->getData();
+ $chunks = [];
+
+ // Deprecations for only=styles modules
+ if ( $data['styleDeprecations'] ) {
+ $chunks[] = ResourceLoader::makeInlineScript(
+ implode( '', $data['styleDeprecations'] ),
+ $this->options['nonce']
+ );
+ }
+
+ return WrappedString::join( "\n", $chunks );
}
private function getContext( $group, $type ) {
* @param array $modules One or more module names
* @param string $only ResourceLoaderModule TYPE_ class constant
* @param array $extraQuery [optional] Array with extra query parameters for the request
- * @param string $nonce [optional] Content-Security-Policy nonce (from OutputPage::getCSPNonce)
+ * @param string|null $nonce [optional] Content-Security-Policy nonce
+ * (from OutputPage::getCSPNonce)
* @return string|WrappedStringList HTML
*/
public static function makeLoad( ResourceLoaderContext $mainContext, array $modules, $only,