I am playing around with an idea for an CMS extension autoloader.
The goal is to create a single function capable of loading the classes for every extension for both the admin and site application.
Since we are at a very early stage with our project, and have only two components so far in our "site" application, maybe we can implement it and see how it works.
The required changes would be to register the common autoloader instead of the specific autoloader for com_tracker, change the lookup for the view- and model classes inside the tracker default controller (or even better, create a common default controller) and - to prefix all the classes with a Com
.
The "magic" function can be seen here: https://gist.github.com/3936393
The logic to name the classes would be:
ComFooModelBar
to load
JROOT/components/com_foo/model/bar.php
ComAdminFooModelBar
to load
JROOT/administrator/components/com_foo/model/bar.php
Same for modules, plugins and templates.
Thoughts ¿
Should be covered by the namespacing stuff and composer autoloader introduced recently.
Performance wise, is it any better or worse than using the Platform autoloader? I guess I've never really thought of autoloading across applications, but always though it'd be nice if certain files were always auto loaded (the plugin structure should really be the first to change to adapt to the Platform's autoloader, but good luck convincing the CMS to take it...).
I'll definitely be watching the mvc branch to see where things go. Seeing it in action a little more will probably help me think things through.