PR-6.2-dev Architecture Pending

User tests: Successful: Unsuccessful:

avatar MacJoom
MacJoom
9 Jun 2026

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.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Build with help of AI - reviewed.

Summary of Changes

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

  • Code review and testing:

Testing Instructions

Setup

  1. Install this branch on a Joomla 6.2-dev nightly with the default sample data.

    • You can install the prebuild package (at the bottom of the checks list)
    • or you can add the patch with the Patchtester to a Joomla 6.2-dev nightly build
    • or you can checkout this branch from upstream
  2. 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}).

  3. Create one custom field each for Articles, Contacts, Users, and Categories, set to render in different positions (after title / before content / after content).

  4. 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:

  • Archive (Archive/HtmlView → com_content.archive) — Archived Articles menu item
  • Featured (Featured/HtmlView → com_content.featured) — Featured Articles menu item
  • Category blog + list (Category/HtmlView → com_content.category) — both menu item types
  • Category description (tmpl/category/blog.php + layouts/.../category_default.php → *.categories) — page header shows the category's own custom fields / plugin output
  • Shared CategoryView (libraries/.../CategoryView → *.category) — a com_contact or com_newsfeeds category listing
  • Single contact (Contact/HtmlView → com_contact.contact) — fields + cloaked email in misc/text
  • Contact linked-user fields (Contact/HtmlView → com_users.user) — set the contact's Linked User and enable "show user custom fields"
  • User profile (Profile/HtmlView → com_users.user) — front-end profile page shows user custom fields
  • Tagged items (Tag/HtmlView → com_tags.tag) — Tagged Items page
  • Newsflash module (mod_articles_news → com_content.article) — intro text shows processed plugin output
  • Smart Search (com_finder/.../Helper → com_finder.indexer) — rebuild the index (no fatal), then search returns plugin-prepared text
  • API single article (JsonapiView → com_content.article) — GET /api/index.php/v1/content/articles/{id} returns prepared content + custom field values

Regression checks (the by-reference removal)

  • Enable a third-party content plugin that modifies $article->text (or write a small one) and confirm its changes still appear on an article — proves dropping &$item didn't break mutation.
  • With display_errors on, confirm no Only variables should be passed by reference notices and no Undefined array key warnings from the event objects.

Before/after comparison

  • Screenshot each view above on unpatched 6.2-dev and on this branch — output must be identical. Any visible difference is a bug.

Actual result BEFORE applying this Pull Request

Site works

Expected result AFTER applying this Pull Request

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.

Link to documentations

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

avatar MacJoom MacJoom - open - 9 Jun 2026
avatar MacJoom MacJoom - change - 9 Jun 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Jun 2026
Category Administration com_finder Front End com_contact com_content com_tags com_users Layout Libraries Modules
avatar MacJoom MacJoom - change - 9 Jun 2026
Labels Added: PR-7.0-dev
avatar MacJoom MacJoom - change - 9 Jun 2026
The description was changed
avatar MacJoom MacJoom - edited - 9 Jun 2026
avatar joomdonation
joomdonation - comment - 11 Jun 2026

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

avatar MacJoom
MacJoom - comment - 12 Jun 2026

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

avatar MacJoom
MacJoom - comment - 12 Jun 2026

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

avatar joomla-cms-bot joomla-cms-bot - change - 16 Jun 2026
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
avatar MacJoom MacJoom - change - 16 Jun 2026
Title
[7.0] [AI] Use named arguments for content display triggerEvent() calls
[6.1] [AI] Use named arguments for content display triggerEvent() calls
avatar MacJoom MacJoom - edited - 16 Jun 2026
avatar joomla-cms-bot joomla-cms-bot - change - 16 Jun 2026
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
avatar MacJoom MacJoom - change - 16 Jun 2026
Title
[6.1] [AI] Use named arguments for content display triggerEvent() calls
[6.2] [AI] Use named arguments for content display triggerEvent() calls
avatar MacJoom MacJoom - edited - 16 Jun 2026
avatar MacJoom MacJoom - change - 16 Jun 2026
The description was changed
avatar MacJoom MacJoom - edited - 16 Jun 2026
avatar laoneo
laoneo - comment - 18 Jun 2026

Is this one still needed, when we have #47973?

avatar joomdonation
joomdonation - comment - 18 Jun 2026

Is this one still needed, when we have #47973?

All necessary changes are included in PR #47973 . So once #47973 is accepted, this PR is not needed anymore

avatar laoneo laoneo - change - 19 Jun 2026
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
avatar laoneo laoneo - close - 19 Jun 2026
avatar laoneo
laoneo - comment - 19 Jun 2026

Then I close this one as we definitely want to go with #47973. Thanks AI for your contribution 😄

Add a Comment

Login with GitHub to post a comment