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.1] AdminController - Add context if any, to redirect URL #37818

Closed

Conversation

pe7er
Copy link
Contributor

@pe7er pe7er commented May 17, 2022

Pull Request to fix missing context for com_fields when doing actions like publishing or unpublishing Field or Field Group items.

Summary of Changes

In the Custom Field Groups and Custom Fields of Content & Users, the left menu closed after doing an action (like publish or unbublish) on a Custom Field Group Item or Custom Field Item.

Field Groups menu closes when doing actions

  1. In back-end go to: Content > Field Groups
  2. Create a Field group and Save & Close
    field-groups-1
  3. Notice the URL:
    /administrator/index.php?option=com_fields&view=groups&context=com_content.article
  4. Unpublish the Group
    field-groups-2
  5. Notice the new URL and the closed Menu:
    /administrator/index.php?option=com_fields&view=groups
    The Context is not passed through, and the menu has been closed.
    The same issue happens in other places with other Custom Fields too.

Testing Instructions

Go to each of the following menu items and publish or unpublish an item:

  1. Content > Field Groups /administrator/index.php?option=com_fields&view=groups&context=com_content.article
  2. Content > Fields /administrator/index.php?option=com_fields&view=fields&context=com_content.article
  3. Users > Field Groups /administrator/index.php?option=com_fields&view=groups&context=com_users.user
  4. Users > Fields /administrator/index.php?option=com_fields&view=fields&context=com_users.user
    /administrator/index.php?option=com_fields&view=fields&context=com_content.article

Actual result BEFORE applying this Pull Request

After doing a publish or unpublish action in com_fields, the menu on the left closes because the URL is missing the &context=[component][view]

Expected result AFTER applying this Pull Request

After doing a publish or unpublish action in com_fields, the menu on the left remains open because the right context &context=[component][view] is passed through via the URL.

@brianteeman
Copy link
Contributor

also see #34067

@@ -115,6 +115,17 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu
}

$this->view_list = strtolower($r[2]);

// Add the context to $this->view_list to use in the redirect URL
if (isset($app->input))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

App should always have an input

@joomdonation
Copy link
Contributor

@pe7er The propose change does not look right to me. For this, you should modify code in Fields and Groups controllers of com_fields instead. Just add getRedirectToListAppend method to the two controllers with the below code should solve the issue:

protected function getRedirectToListAppend()
{
	$context = $this->input->getString('context');

	if ($context)
	{
		return '&context=' . $context;
	}
}

@Quy Quy added Updates Requested Indicates that this pull request needs an update from the author and should not be tested. and removed Information Required labels Jun 25, 2022
@HLeithner HLeithner changed the base branch from 4.1-dev to 4.2-dev June 27, 2022 13:05
@HLeithner
Copy link
Member

This pull requests has automatically rebased to 4.2-dev.

@joomla-bot
Copy link
Contributor

This pull requests has been automatically converted to the PSR-12 coding standard.

@joomdonation
Copy link
Contributor

Hi @pe7er

Look like you are too busy and do not have time to make the suggested change as I commented #37818 (comment) . So I made the PR #39926 to replace this one to have this issue fixed and close this PR. Hope that's fine for you. If you still want to finish this PR, please let me know. I will close mine and re-open yours. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Updates Requested Indicates that this pull request needs an update from the author and should not be tested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants