Page MenuHomePhabricator

extension.json / skin.json: Overriding of values, e.g. "ResourceLoaderLESSVars"
Closed, DeclinedPublic

Description

Use case: I've got one base skin "BlueSpiceSkin" that defines a bunch of LESS variables using "ResourceLoaderLESSVars" field in skin.json. I want to override some of those variables in a skin that derives from that base skin (e.g. "BlueSpiceLite").

Problem: When I set the same variable name in the skin.json of the derived skin ExtensionRegistry does not override the value but (by using array_merge_recursive) creates a array with both values. This can not be interpreted by the Less parser.

Example:
BlueSpiceSkin/skin.json:

...
"ResourceLoaderLESSVars": {
   "body-font-size": "1em",
    ...

BlueSpiceLite/skin.json:

...
"ResourceLoaderLESSVars": {
   "body-font-size": "0.8em",
    ...

Result provided to Less parser:
BlueSpiceSkin/skin.json:

[
   "body-font-size":  [ "1em", "0.8em"]
    ...
]

I believe this behavior is the same for most other fields in extension.json / skin.json. Is there a recommended way for my use case? Is this maybe something that needs to be changed in ExtensionRegistry? (Maybe consider to use array_replace_recursive instead of array_merge_recursive at least for some fields)

Event Timeline

Legoktm subscribed.

I think this is probably a good example of why that configuration variable is deprecated and getting phased out - T140804: Remove $wgResourceLoaderLESSVars and ResourceLoaderGetLessVars hook. I'm declining this on those grounds, but in general the ExtensionRegistry makes no commitment to in what order things will be loaded in, so it wouldn't know which setting should take precedent over the other.