User tests: Successful: Unsuccessful:
This PR is in preparation of PR #47459
Convert the positional argument arrays passed to onContentPrepare, onContentAfterTitle, onContentBeforeDisplay and onContentAfterDisplay into named arguments (context, subject, params, page).
These events resolve to ContentPrepareEvent (and its AfterTitleEvent / BeforeDisplayEvent / AfterDisplayEvent subclasses), which today rely on the ReshapeArgumentsAware trait to remap positional arrays onto named keys. Once that trait is removed (PR #47459) a positional array would fail the required-key validation with a BadMethodCallException, so these call sites must pass named arguments. The change is compatible with the current code as well, since the constructors accept named arguments directly.
The pass-by-reference markers are dropped: the subject is always an object, so plugin mutations propagate by handle without a reference.
Build with help of AI - reviewed.
Converts the positional argument arrays in triggerEvent() calls for the four content-display events — onContentPrepare, onContentAfterTitle, onContentBeforeDisplay, onContentAfterDisplay — into named-key arrays (context, subject, params, page), and drops the now-unnecessary & by-reference markers. Pure refactor across 12 files; no behaviour change intended.
Testing Instructions
Setup
Install this branch on a Joomla 6.2-dev nightly with the default sample data.
Make sure the core content plugins are enabled so the events output is visible:
Fields - (custom fields render via the title/before/after events), Content - Email Cloaking, Content - Page Break, Content - Load Modules ({loadposition} / {loadmodule}).
Create one custom field each for Articles, Contacts, Users, and Categories, set to render in different positions (after title / before content / after content).
In one article's intro text, add an email address and a {loadposition } for a published module.
Functional checks
For each context below the page must render with custom fields in the correct slots, the email cloaked, and the loaded module visible — proving the events fired and mutated the text:
Regression checks (the by-reference removal)
Before/after comparison
Site works
Site works
Every view renders exactly as on 6.2-dev: custom fields, cloaked emails, loaded modules, and third-party plugin output all appear unchanged, with no PHP notices.
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_finder Front End com_contact com_content com_tags com_users Layout Libraries Modules |
| Labels |
Added:
PR-7.0-dev
|
||
And I wonder why we do not do this for 6.2-dev ? I think we should update core code to use less deprecated code as much as possible
Thank you - good point - i will rebase it to 6.2
And I wonder why we do not do this for 6.2-dev ? I think we should update core code to use less deprecated code as much as possible
Thank you - good point - i will rebase it to 6.2
| Category | Administration com_finder Front End com_contact com_content com_tags com_users Layout Libraries Modules | ⇒ | Administration com_categories com_finder com_installer com_users Front End com_contact com_content com_newsfeeds com_tags Layout Libraries Modules Plugins |
| Title |
|
||||||
| Category | Administration com_finder Front End com_contact com_content com_tags com_users Layout Libraries Modules com_categories com_installer com_newsfeeds Plugins | ⇒ | Administration com_finder Front End com_contact com_content com_tags com_users Layout Libraries Modules |
| Title |
|
||||||
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-06-19 07:11:17 |
| Closed_By | ⇒ | laoneo | |
| Labels |
Added:
PR-6.2-dev
Architecture
Removed: PR-7.0-dev |
||
Instead of continue trigger events using legacy event trigger $app->triggerEvent like this, we should update code use modern event trigger with concrete event classes, same as we did for article view https://github.com/joomla/joomla-cms/blob/5.4-dev/components/com_content/src/View/Article/HtmlView.php#L228-L254
And I wonder why we do not do this for 6.2-dev ? I think we should update core code to use less deprecated code as much as possible