? Pending

User tests: Successful: Unsuccessful:

avatar Harmageddon
Harmageddon
1 Sep 2019

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 the getRedirectToListAppend / getRedirectToItemAppend methods in my controllers derived from FormController to ensure that the extension URL parameter is attached correctly when editing, saving or exiting an item. However, I noticed that the AdminController lacks such a method. When looking at the overrides that already the Joomla! core has for delete, publish and checkin, 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

  • Implemented AdminController::getRedirectToListAppend.

Using this method, I changed the following overrides:

  • AdminController::delete

  • AdminController::publish

    • StagesController: Was a call to the parent method with a different redirect.
    • TransitionsController: Was a call to the parent method with a different redirect.
  • AdminController::checkin

    • CategoriesController: Was a call to the parent method with a different redirect.
    • ItemsController: diff to the AdminControllerimplementation
    • StagesController: Was a call to the parent method with a different redirect.

Testing Instructions

  1. Make sure that deleting an item (from trashed state!) still works and you are redirected to the right page afterwards for the following:
    • categories
    • history entries (e.g. in an article)
    • workflow stages
    • workflow transitions
    • workflows
  2. Make sure that publishing / unpublishing / trashing still works and you are redirected to the right page afterwards for the following:
    • workflow stages
    • workflow transitions
  3. Make sure that checking in items that are currently being edited still works and you are redirected to the right page afterwards for the following:
    • categories
    • menu items
    • workflow stages

Additional discussion points

Default behaviour

I implemented the getRedirectToListAppend as an empty stub in AdminController. If we want to consider common URL parameters, some default could be added here. For example, the publish method already added an extension parameter, while delete and checkin didn't. I deleted this for the sake of consistency, but as I'm writing this, I tend to add it as a default to getRedirectToListAppend to avoid issues for 3rd party components that were relying on this behaviour of publish. What do you think?

saveorder / reorder

I didn't change the methods saveorder and reorder, 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

public function publish()
{
parent::publish();
$this->setRedirect('index.php?option=com_content&view=featured');
}

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 by ArticlesController, not by FeaturedController.

avatar Harmageddon Harmageddon - open - 1 Sep 2019
avatar Harmageddon Harmageddon - change - 1 Sep 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Sep 2019
Category Administration com_categories com_content com_contenthistory com_menus com_workflow Libraries
avatar Harmageddon Harmageddon - change - 1 Sep 2019
Labels Added: ?
avatar wilsonge
wilsonge - comment - 2 Sep 2019

This looks very sensible to me

avatar wilsonge wilsonge - close - 2 Sep 2019
avatar wilsonge wilsonge - merge - 2 Sep 2019
avatar wilsonge wilsonge - change - 2 Sep 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-09-02 13:26:49
Closed_By wilsonge
avatar wilsonge
wilsonge - comment - 2 Sep 2019

Thanks!

Add a Comment

Login with GitHub to post a comment