Topic on Project:Support desk/Flow

MW 1.26: How to fix "style module should define its position explicitly" warning for custom skin?

7
CayceP (talkcontribs)

After updating the latest stable release of Mediawiki 1.26. my custom skin throws the following warning:

Warning: OutputPage::getModuleStyles: style module should define its position explicitly: ext.addThis ResourceLoaderFileModule [Called from OutputPage::getModuleStyles in \w\includes\OutputPage.php at line 621] in C:\xampp\htdocs\w\includes\debug\MWDebug.php on line 300

According to this page this can be fixed via editing the skins' skin.json, which is currently not existing for my skin (has never been required before). Does anyone know how to fix this?

In the release notes (line 95 ff) it's also mentioned that all skis and extensions should have set a ""manifest_version" property corresponding to   the schema version they were written for. The only supported version  currently is "1"."

So this means all custom skins require a skin.json from now on?

88.130.80.169 (talkcontribs)

You can or cannot use a skin.json file. That is not the point.

The thing is that your skin somewhere defines configuration for ResourceModules: Either in one of its PHP files as $wgResourceModules or in skin.json in ResourceModules. Inside there, below the entry for the styles (e.g. below skins.vector.styles), you will have to add a position like so (code from skin.json of the Vector skin):

	"ResourceModules": {
		"skins.vector.styles": {
			"position": "top",
			"styles": {
				"screen.less": {
					"media": "screen"
				},
			...

As for the switch to skin.json: Yes, registering a skin using a skin.json file is the new way to go. See Manual:Extension registration for more details!

CayceP (talkcontribs)

Yes, I figured that much and tried that, which did not help. Since I created my skin according to the skinning manual, I don't know how/where to provide the the skins.vector.styles

in my skin.php file, since in the manual is only described on how provide one style name, not several.

$wgResourceModules['skins.foobar'] = array(
	'styles' => array(
		'resources/screen.css' => array( 'media' => 'screen' ),
	),
	'remoteSkinPath' => 'FooBar',
	'localBasePath' => __DIR__,
);

The only way where I see a possibility to this, is in the skin.json, which means I (and all other people with a custom skin, I presume) have to rebuild my custom skin.

So I did that, created a new version based on the ExampleSkin, but this didn't work either, it still throws the warning and in now it no longer loads/displays my .css file.

88.130.97.228 (talkcontribs)
$wgResourceModules['skins.foobar'] = array(
	'position' => 'top',
	'styles' => array(
		'resources/screen.css' => array( 'media' => 'screen' ),
	),
	'remoteSkinPath' => 'FooBar',
	'localBasePath' => __DIR__,
);

should solve the problem.

Using skin.json is an alternative; it also works woth the PHP array, which I posted here. Basically you have to add the "position" key - no matter, if you are using PHP code or a skin.json file.

Kc5vcx (talkcontribs)

How should this get added to a dependency of an extension, for example SemanticFormsInputs datepicker. I'm using the default Vector skin.

I had tried added in a position element like below, but doesn't seem to help here and not quite sure what I'm doing. I think it's called the dependency 'jquery.ui.datepicker', but don't know where it's defined.

$wgResourceModules['ext.semanticformsinputs.datepicker'] = array(

'position' => 'top',

'localBasePath' => $dir,

'remoteExtPath' => 'SemanticFormsInputs',

'scripts' => 'libs/datepicker.js',

'dependencies' => array(

'jquery.ui.datepicker',

'ext.semanticforms.main'

),

);

I had also responded here

Topic:Sprswqpt682hyjki

Kc5vcx (talkcontribs)

Ah ha, it's in resources/Resources.php. This works now. Should it be added to the release (I don't have developer access)?

'jquery.ui.datepicker' => array(

    'position' => 'top',

    'scripts' => 'resources/lib/jquery.ui/jquery.ui.datepicker.js',

Ciencia Al Poder (talkcontribs)
Reply to "MW 1.26: How to fix "style module should define its position explicitly" warning for custom skin?"