User tests: Successful: Unsuccessful:
Pull Request for Issue # .
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.
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.
I expect a module which prepares content (or any item which prepares content and has params) to pass its params to the content plugins.
As it is, modules which prepare content are not passing their params.
Maybe
Status | New | ⇒ | Pending |
Category | ⇒ | Modules Administration Front End |
Labels |
Added:
?
|
Category | Modules Administration Front End | ⇒ | Modules Administration Libraries Front End |
I have tested this item
This is an API change and will likely not go into J3, please rebase your PR against 4.0 branch.
@HLeithner I see it as more of a bugfix but OK, I can do that.
closing as Pull Request will be rebased against 4.0-Branch.
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
|
I've fixed
JHtmlContent::prepare
so that it consistently passes$params
as aRegistry
toonContentPrepare
. 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.