Feature RTC PBF PR-6.1-dev Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
3 Dec 2025

Pull Request for Issue # .

Summary of Changes

This PR adds two new methods, getRedirectUrlToItem() and getRedirectUrlToList(), to the FormController class. These methods centralize the generation of redirection URLs and replace repeated code blocks inside the class.

If accepted, this approach can be extended to child classes of FormController, reducing code duplication and improving maintainability.

Testing Instructions

  • Use Joomla 6.1
  • Apply patch
  • Try to add/edit article and make sure everything is still working as expected
  • On Articles Management screen, try to publish/unpublish/delete articles and make sure it still works like before

Actual result BEFORE applying this Pull Request

Works, but there is repeating code

Expected result AFTER applying this Pull Request

Cleaner, shorter code and can be used by child classes

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomdonation joomdonation - open - 3 Dec 2025
avatar joomdonation joomdonation - change - 3 Dec 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 3 Dec 2025
Category Libraries
d0ab493 3 Dec 2025 avatar joomdonation CS
avatar joomdonation joomdonation - change - 3 Dec 2025
Labels Added: PR-6.1-dev
avatar HLeithner
HLeithner - comment - 3 Dec 2025

We have the same "issue" in the AdminController, not sure if FromController is the right place to implement this.

avatar joomdonation
joomdonation - comment - 3 Dec 2025

Yes, I’m aware of that. However, since AdminController does not extend FormController, there isn’t a straightforward way to share these methods between them. One alternative would be to introduce a trait for these reusable methods, but adding a trait for just one or two methods might not be justified at this stage.

Please note that AdminController already contains its own implementation of a similar method (https://github.com/joomla/joomla-cms/blob/6.1-dev/libraries/src/MVC/Controller/AdminController.php#L479), which mirrors the one in FormController (https://github.com/joomla/joomla-cms/blob/6.1-dev/libraries/src/MVC/Controller/FormController.php#L506). That means that the two controller classes were designed to be independent. So maybe the two methods can stay here in FormController, then we can implement getRedirectToListUrl method to AdminController, too.

avatar HLeithner
HLeithner - comment - 3 Dec 2025

if it should not be in the base class then a trait is perfectly fine for this.

avatar joomdonation
joomdonation - comment - 3 Dec 2025

The trait would then only contains getRedirectToListUrl because AdminController does not need getRedirectToItemUrl. I'm unsure if that makes much sense.

avatar HLeithner
HLeithner - comment - 3 Dec 2025

you might be right, then please add the getRedirectToListUrl to the also to the admincontroller

avatar joomdonation joomdonation - change - 3 Dec 2025
The description was changed
avatar joomdonation joomdonation - edited - 3 Dec 2025
avatar joomdonation
joomdonation - comment - 3 Dec 2025

you might be right, then please add the getRedirectToListUrl to the also to the admincontroller

Done, thanks ! FYI, I see many possible improvements to FormController code (especially for save method) to make easier to override when it is needed. As of right now, many child controllers in have to copy/paste the whole code of the method (for example https://github.com/joomla/joomla-cms/blob/6.1-dev/administrator/components/com_finder/src/Controller/FilterController.php#L40) to add it own logic which is not nice. We should improve it.

avatar HLeithner
HLeithner - comment - 3 Dec 2025

that's true, if you find a nice way to split the save function into multiple so easier overriding is possible please go for it.

avatar Fedik
Fedik - comment - 4 Dec 2025

I cannot speak about whether it is needed.
But I would suggest to use different naming, like getRedirectUrl...(), getRedirectUrlFoo(), getRedirectUrlBar().
It should be more easy to search and read in my opinion.

avatar joomdonation
joomdonation - comment - 4 Dec 2025

I cannot speak about whether it is needed.

The two methods provide quicker way to get the URLs instead of having to repeat writing longer code to build these URLs everywhere (the two classes modified in this PR are just a start, there are many code like that in child classes)

But I would suggest to use different naming, like getRedirectUrl...(), getRedirectUrlFoo(), getRedirectUrlBar()

I'm open for suggestion. In my extensions, I use getViewListUrl and getViewItemUrl. I think the suggested getRedirectUrl does not really describe what the methods do.

avatar Fedik
Fedik - comment - 4 Dec 2025

I think the suggested getRedirectUrl does not really describe what the methods do.

I just mean "flip words" around getRedirectToItemUrl => getRedirectUrlToItem πŸ˜‰

avatar joomdonation joomdonation - change - 5 Dec 2025
Labels Added: Feature
avatar joomdonation
joomdonation - comment - 5 Dec 2025

I just mean "flip words" around getRedirectToItemUrl => getRedirectUrlToItem

Thanks, it's indeed better, but having a little naming conflict with the existing method getRedirectToItemAppend. But I changed the name as suggested.

avatar joomdonation joomdonation - change - 5 Dec 2025
The description was changed
avatar joomdonation joomdonation - edited - 5 Dec 2025
avatar joomdonation
joomdonation - comment - 5 Dec 2025

that's true, if you find a nice way to split the save function into multiple so easier overriding is possible please go for it.

@HLeithner PR created #46537. I also include changes from this PR in that PR to make the code shorter/more clear.

avatar tecpromotion tecpromotion - change - 29 Jan 2026
Labels Added: PBF
avatar crimle crimle - test_item - 30 Jan 2026 - Tested successfully
avatar crimle
crimle - comment - 30 Jan 2026

I have tested this item βœ… successfully on 6be034e


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

avatar Elfangor93 Elfangor93 - test_item - 30 Jan 2026 - Tested successfully
avatar Elfangor93
Elfangor93 - comment - 30 Jan 2026

I have tested this item βœ… successfully on 6be034e

Tested with com_content, com_users and com_contact. No problems found.


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

avatar exlemor exlemor - test_item - 30 Jan 2026 - Tested successfully
avatar exlemor
exlemor - comment - 30 Jan 2026

I have tested this item βœ… successfully on 6be034e

Hi @joomdonation, I have tested this successfully during PBF 2026 on 2 different installations - PBF Rochen PHP 8.3 instance and my own hosting PHP 8.5 instance.

For the PBF Rochen instance, I tried multi-lingual articles, with different ACL Levels, greek/French characters, Language Associations, as well as past and future Publishing dates, deletion, restoration, played w/ display options, with/without images, with tags, notes...

For my own hosting instance, 5000 word document in 3 languages with associations, table, code snippet, different author user, deleting, restoring, playing with display options, etc...

Really tried to beat it up ;)


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

avatar jikubiswal jikubiswal - test_item - 31 Jan 2026 - Tested successfully
avatar jikubiswal
jikubiswal - comment - 31 Jan 2026

I have tested this item βœ… successfully on 6be034e

I have completed the functional verification of the patch and can confirm that it is working correctly. SHA: 6be034e

I performed the following tests in the browser:

Cancel: Verified that it correctly redirects to the Articles list.
Save & Close: Verified that it correctly redirects to the Articles list after saving.
Save (Apply): Verified that it correctly redirects back to the Article edit page (item view) after saving.
All redirection flows triggered the new getRedirectUrlToItem() and getRedirectUrlToList() methods as expected, maintaining the standard Joomla behavior while using the refactored, centralized logic.


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

avatar alikon alikon - change - 31 Jan 2026
Status Pending Ready to Commit
avatar alikon
alikon - comment - 31 Jan 2026

RTC


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

avatar HLeithner
HLeithner - comment - 11 Feb 2026

@joomdonation can you please resolve the conflicts then I can merge this here too. thanks

avatar joomdonation joomdonation - change - 11 Feb 2026
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2026-02-11 13:49:04
Closed_By joomdonation
Labels Added: RTC
avatar joomdonation joomdonation - close - 11 Feb 2026
avatar joomdonation
joomdonation - comment - 11 Feb 2026

@HLeithner The changes in this PR is already included in #46537, so I'm closing this one.

avatar HLeithner
HLeithner - comment - 11 Feb 2026

thanks, that was not fully clear to be.

Add a Comment

Login with GitHub to post a comment