Open mwjames opened 7 years ago
I agree that we have an issue with a bloated Resources.php. But I really don't like the introduction of a new global.
What about something like ResultPrinter::getResources()
?
What about something like ResultPrinter::getResources()?
Then you would have path dependencies within a class object since you have to define the access to the files somehow. Of course, you could use a convention to overcome this but registration of $GLOBALS['wgResourceModules']
should not happen from within ResultPrinter
so this needs to happen when SemanticResultFormats
is loaded.
Yes, we'd need a convention. I'd argue ResultPrinters should give paths in relation to their root folder. This way we could nudge them towards being better contained and staying in their folder.
And registration does not need to happen from within the ResultPrinter. You could still use that foreach
loop, just instead of include( $GLOBALS['srfgFormatResources'][$format] )
you'd have something like ResultPrinter::getResources()
.
Issue
Currently, all resources are defined in
Resource.php
which becomes rather "stuffed", so I was thinking what about an extra internal setting to map the location of a format specificResource.php
and do arequire_once
with the registration of a format?Proposed solution