[4.0] Add getRedirectToListAppend to AdminController #26120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While developing a component that can be used in different components by a URL parameter
&extension=com_something
like it is done in com_categories, I'm using thegetRedirectToListAppend
/getRedirectToItemAppend
methods in my controllers derived fromFormController
to ensure that the extension URL parameter is attached correctly when editing, saving or exiting an item. However, I noticed that theAdminController
lacks such a method. When looking at the overrides that already the Joomla! core has fordelete
,publish
andcheckin
, I thought that not only 3rd party components would profit from such a method, but also the core methods that could be simplified.Summary of Changes
AdminController::getRedirectToListAppend
.Using this method, I changed the following overrides:
AdminController::delete
AdminController
implementationAdminController
implementationAdminController::publish
AdminController::checkin
AdminController
implementationTesting Instructions
Additional discussion points
Default behaviour
I implemented the
getRedirectToListAppend
as an empty stub inAdminController
. If we want to consider common URL parameters, some default could be added here. For example, thepublish
method already added anextension
parameter, whiledelete
andcheckin
didn't. I deleted this for the sake of consistency, but as I'm writing this, I tend to add it as a default togetRedirectToListAppend
to avoid issues for 3rd party components that were relying on this behaviour ofpublish
. What do you think?saveorder / reorder
I didn't change the methods
saveorder
andreorder
, because I couldn't find any place where they are used, except for the old quickicons from 1.5, where the order could be changed with arrows up / down and a save icon on top of the column. But I assume those are not used anymore, either.FeaturedController::publish
joomla-cms/administrator/components/com_content/Controller/FeaturedController.php
Lines 76 to 81 in 6e3c348
For FeaturedController, I hesitated a while. It overrides
publish
by calling the parent method and then setting the redirect to'index.php?option=com_content&view=featured'
. If "featured" was the value for$this->view_list
, this override would be redundant in my POV. But I can't verify this, because I don't see where this method is called. When publishing an article in the "featured" view, the method is called byArticlesController
, not byFeaturedController
.