-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
components resourceloader ignored #315
Comments
I don't see an easy solution within Chameleon. When getting a message in code (irrespective of Chameleon) it would be unexpected to have a side-effect beyond just returning the final text. While not a general solution, in this case you can create a custom component which is similar to the This is the simplest example if you put it directly in the Chameleon directory: <?php
namespace Skins\Chameleon\Components;
class Sidebar extends Component {
public function getHtml() {
return $this->getSkinTemplate()->getMsg( 'MyMenu' )->parse();
}
public function getResourceLoaderModules() {
return [ 'ext.SimpleBatchUpload' ];
}
} Which can be used in the layout XML: <component type="Sidebar" /> Making changes in the Chameleon directory isn't a good idea because you can lose changes with an update, so a better solution would be to create a custom extension that does this. I created a repo with an example of how to create a new extension to add custom components outside of the Chameleon directory: |
This week I began work on a boilerplate extension for extending the Chameleon skin. There are other ways to bundle customisations, but I went with the helpful suggestion by @malberts to wrap everything in an extension. It will include what I think is a fix for this issue. It uses a new abstract class that extends the Component by allowing for a wikitext page to be selected. Where the wikitext gets parsed, it will also fetch the required modules from the ParserOutput and add them to getResourceModules(). More on that later. |
When you create a custom layout with custom components. For one component ( in this case a sidebar ), we load a system message and parse it. The system message is a page in the wiki with a template. The template calls a parser function (batch file upload). The content is rendered, but the resourceloader does not load any css and js defined in batchfileupload extension.
After some testing, any (parser-)extension that defines js and or css needed when called is ignored when we set this up through a component. When we just call the system message using Int on a page it works fine. Just not from a skin component.
Any suggestions?
mw 1.35.5
php 7.4.25
chameleon 3.4.1
The text was updated successfully, but these errors were encountered: