? Pending

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
17 Jan 2019

Pull Request for Issue # .

Summary of Changes

When using the 'Prepare Content' option in mod_custom, the module params will be passed to the event handler. The 'onContentPrepare' event accepts a params (Registry) object but, for most types of content, none is sent. Why? We actually need this.

Unless there is some good reason why params are not being passed here and in a lot of other cases where they could be, I will expand on this to have them passed in all suitable cases. Also, JHtmlContent::prepare does something weird as well. When $params is not passed (or passed as null), it creates $params as a JObject and passes it to the plugins. Which is weird because you'd really want a Registry there. But worst of all is that most callers of that function do not pass null but rather '' so then it's not even set as a JObject, it's just an empty string. So plugins don't know what to expect. It's a mess. I recommend that, when $params is not a Registry, we do $params = new Registry($params); so that we can always pass a registry to the plugins.

Testing Instructions

OK... so to test this I guess you're going to want to create a content plugin that implements onContentPrepare and then set one or more modules to prepare content.

Expected result

I expect a module which prepares content (or any item which prepares content and has params) to pass its params to the content plugins.

Actual result

As it is, modules which prepare content are not passing their params.

Documentation Changes Required

Maybe

avatar okonomiyaki3000 okonomiyaki3000 - open - 17 Jan 2019
avatar okonomiyaki3000 okonomiyaki3000 - change - 17 Jan 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Jan 2019
Category Modules Administration Front End
avatar okonomiyaki3000
okonomiyaki3000 - comment - 18 Jan 2019

I've fixed JHtmlContent::prepare so that it consistently passes $params as a Registry to onContentPrepare. It may or may not be an empty Registry but it should be one. The plugins should not have to guess what kind of thing they're receiving. Ideally, Joomla will never pass anything other than Registry there and then plugin functions can be type-hinted.

avatar okonomiyaki3000 okonomiyaki3000 - change - 18 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jan 2019
Category Modules Administration Front End Modules Administration Libraries Front End
avatar viocassel
viocassel - comment - 27 Jan 2019

I have tested this item successfully on cfa3adc


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

avatar viocassel viocassel - test_item - 27 Jan 2019 - Tested successfully
avatar HLeithner
HLeithner - comment - 27 Jan 2019

This is an API change and will likely not go into J3, please rebase your PR against 4.0 branch.

avatar okonomiyaki3000
okonomiyaki3000 - comment - 28 Jan 2019

@HLeithner I see it as more of a bugfix but OK, I can do that.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Apr 2019

closing as Pull Request will be rebased against 4.0-Branch.

avatar franz-wohlkoenig franz-wohlkoenig - change - 24 Apr 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-04-24 09:42:45
Closed_By franz-wohlkoenig
Labels Removed: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - close - 24 Apr 2019

Add a Comment

Login with GitHub to post a comment