User tests: Successful: Unsuccessful:
Template providers often ship the same module chromes with every template. It is much more convenient to manage one file and ship a plugin or a plugin + library that could register these module chromes.
Unfortunately a popular template framework provider already implements this concept by overriding
the core file /libraries/cms/module/helper.php with their framework initialization plugin for the purposes of adding their own triggerEvent.
A plugin that executes on the onGetModuleChromes must return an array with keys element (friendly name for their list of module chromes) and path (path to file containing module chrome definitions)
Category | ⇒ | Layout Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Labels |
Added:
?
|
@jrseliga @Bakual here is a PR that should fix the described issues and also with some simplications: jrseliga#1
@Bakual @zero-24 forgetting $app was a poor copy-paste from my development site.
Looks like @zero-24 fixed the issues, I'll merge that PR.
@Bakual, I will provide a plugin for testing, first I'd like to update /libraries/cms/form/field/chromestyle.php so that the module's configuration can see these chromes as options in "Module Style".
Originally this was also going to include the ability to override a layout for modules via a plugin, however testing revealed the dependency this has on plugin priority. Injecting a layout in this way is not conducive, or predictable for developers or site administrators. Will remove this event.
Despite the branch name this will only focus on module chromes as the general problem I'd like to solve is template providers needing to change manage the same /templates/template/html/modules.php across all of their templates. If you reuse the same chrome, ship your template with a library and a plugin (or just a plugin) that registers your a path to your chrome file(s). If it matches the Joomla! chrome function naming convention it will be registered.
Layout override via plugin removed for reason above. Will supply a plugin for testing.
Title |
|
@Bakual significant changes were made, the original comment will be rewritten with instructions and more detailed information.
I have two plugins ready for testing to prove it can handle multiple, and have successfully tested functionality.
Should I upload them as a separate repository or is there a way to include them in this branch without the PR noticing them?
I would just put the plugins somewhere available for download. Like Dropbox or your own website. The put the link into the PR here.
While I like the idea if at some point JLayout
is going to be used for this it's probably a good idea to wait for it. This is a new feature so v3.5 is the minimum release for it anyway.
I see a lof of file_exists() checks that could be avoided with JLayout
or at least with JPath
I love the concept and I agree with Roberto. Using JLayout would be the future-proof way to implement such a fundamental feature, especially considering the key role JLayout is poised to have in Joomla! 4 (at least according to the informal discussion we had with half of the PLT and some Joomla! contributors during the Make It Happen session at JaB 15).
Roberto can you help Justin implement that? You're the de facto JLayout expert, the rest of us are mere apprentices :)
@phproberto would like to see this available in 3.5 and would be happy to help implement the concept with JLayout
.
Labels |
Added:
?
|
I have tested this item
Followed the testing steps and working as explained.
@jrseliga Could you update this PR to use JLayout? Thank you.
I have tested this item
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-10-02 14:47:28 |
Closed_By | ⇒ | brianteeman |
First you need to fix some codestyle issue. Between the
if
and the opening(
there has to be a space. So instead ofif(...)
make itif (...)
.To get an idea how this should work and to be able to test it, can you add an example plugin which would contain a few overrides?
Also, please change the order. The template override always should have the last word. With your proposal the plugin would override the template override which would be wrong.