Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Add getRedirectToListAppend to AdminController #26120

Merged
merged 5 commits into from Sep 2, 2019

Conversation

Harmageddon
Copy link
Contributor

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.

@wilsonge
Copy link
Contributor

wilsonge commented Sep 2, 2019

This looks very sensible to me

@wilsonge wilsonge merged commit e9cbbcd into joomla:4.0-dev Sep 2, 2019
@wilsonge
Copy link
Contributor

wilsonge commented Sep 2, 2019

Thanks!

@wilsonge wilsonge added this to the Joomla 4.0 milestone Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants