? ? Success

User tests: Successful: Unsuccessful:

avatar jrseliga
jrseliga
2 Jun 2015

Purpose

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.

How it works

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)

Testing

  1. Install Joomla (sample data not necessary)
  2. Upload plugin folders to /plugins/system
  3. Discover / Enable plugins modulechromesone and modulechromestwo
  4. Navigate to front-end notice the "Login Form" module default-install
  5. Module Manager
    • Login Form
      1. Advanced tab
      2. Module Style
        • Scroll to bottom, will see two new grouped lists Plugin One and Plugin Two module-style
    • Choose any from either of these groups
    • Refresh front-end, the name of the module chrome function used will be displayed in place of the log in form.one
    • Repeat last two steps to see different chromes rendered. four
avatar jrseliga jrseliga - open - 2 Jun 2015
avatar zero-24 zero-24 - change - 3 Jun 2015
Category Layout Libraries
avatar zero-24 zero-24 - change - 3 Jun 2015
Status New Pending
avatar Bakual
Bakual - comment - 3 Jun 2015

First you need to fix some codestyle issue. Between the if and the opening ( there has to be a space. So instead of if(...) make it if (...).

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.

avatar zero-24 zero-24 - change - 3 Jun 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 3 Jun 2015
Labels Added: ?
avatar zero-24
zero-24 - comment - 3 Jun 2015

@jrseliga @Bakual here is a PR that should fix the described issues and also with some simplications: jrseliga#1

avatar jrseliga
jrseliga - comment - 3 Jun 2015

@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".

48a1cf5 3 Jun 2015 avatar zero-24 CS
avatar jrseliga
jrseliga - comment - 4 Jun 2015

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.

avatar jrseliga
jrseliga - comment - 4 Jun 2015

Layout override via plugin removed for reason above. Will supply a plugin for testing.

avatar jrseliga jrseliga - change - 8 Jun 2015
Title
Override module layout with a plugin
Override module chrome with a plugin
avatar jrseliga
jrseliga - comment - 9 Jun 2015

@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?

avatar Bakual
Bakual - comment - 9 Jun 2015

I would just put the plugins somewhere available for download. Like Dropbox or your own website. The put the link into the PR here.

avatar phproberto
phproberto - comment - 9 Jun 2015

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

avatar nikosdion
nikosdion - comment - 9 Jun 2015

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 :)

avatar jrseliga
jrseliga - comment - 9 Jun 2015

@phproberto would like to see this available in 3.5 and would be happy to help implement the concept with JLayout.

avatar brianteeman brianteeman - change - 11 Mar 2016
Labels Added: ?
avatar hardiktailored hardiktailored - test_item - 11 Jul 2016 - Tested successfully
avatar hardiktailored
hardiktailored - comment - 11 Jul 2016

I have tested this item successfully on d90e033

Followed the testing steps and working as explained.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7099.

avatar roland-d
roland-d - comment - 31 Jul 2016

@jrseliga Could you update this PR to use JLayout? Thank you.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7099.

avatar BhaveshTailored BhaveshTailored - test_item - 29 Aug 2016 - Tested successfully
avatar BhaveshTailored
BhaveshTailored - comment - 29 Aug 2016

I have tested this item successfully on d90e033


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7099.

avatar brianteeman
brianteeman - comment - 2 Oct 2016

I am closing this at this time as it appears to have been abandoned by @jrseliga
It can always be re-opened if updated as per @roland-d comments above

avatar brianteeman brianteeman - change - 2 Oct 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-10-02 14:47:28
Closed_By brianteeman
avatar brianteeman brianteeman - close - 2 Oct 2016

Add a Comment

Login with GitHub to post a comment