Problem/Motivation

#2301313: MenuLinkNG part3 (no conversions): MenuLinkContent UI (or ... part #5) uses the ?destination= on the add and edit menu link links,
this is not changed when in the add/edit a different parent menu is selected

Proposed resolution

update the destination to be the menu the menu link is saved to
(maybe do not use destination in the url?)

Remaining tasks

  • clarify some possible resolutions
  • explain the difficulty with the new menu link system
  • ?

User interface changes

Going back to the way head was:
redirect to the new parent menu page.

API changes

?

Comments

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ivnish’s picture

Yes! Redirect to /admin/structure/menu after create new menu item (not new menu) makes me nervous.

ivnish’s picture

Version: 8.6.x-dev » 8.7.x-dev
batkor’s picture

Hi guys!
i think need redirect to parent menu llist

bmx269’s picture

On creating a menu "item", the user should be redirected to the parent menu of that newly created menu item.

batkor’s picture

This problem is related to

#core/module/menu_link_content/menu_link_content.routing.yml
entity.menu.add_link_form:
  path: '/admin/structure/menu/manage/{menu}/add'
  defaults:
    _controller: '\Drupal\menu_link_content\Controller\MenuController::addLink'
    _title: 'Add menu link'
  requirements:
    _entity_create_access: 'menu_link_content'
entity.menu_link_content.canonical:
  path: '/admin/structure/menu/item/{menu_link_content}/edit'
  defaults:
    _entity_form: 'menu_link_content.default'
    _title: 'Edit menu link'
  requirements:
    _entity_access: 'menu_link_content.update'

entity.menu_link_content.edit_form:
  path: '/admin/structure/menu/item/{menu_link_content}/edit'
  defaults:
    _entity_form: 'menu_link_content.default'
    _title: 'Edit menu link'
  requirements:
    _entity_access: 'menu_link_content.update'

If set correct route solved issues in breadcrumb.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ddhuri’s picture

Here is the patch which works perfectly for me while adding and deleting menu links.

matthieuscarset’s picture

Status: Active » Reviewed & tested by the community

Patch #14 works like a charm.

Tested on Drupal 8.7.x with translations enabled.

Marking this issue as RTBC

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Thanks for your work here folks, but we need a test here to enforce this functionality into the future

ddhuri’s picture

Updated #14 patch with minor typos.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Webbeh’s picture

Thanks for your work here folks, but we need a test here to enforce this functionality into the future

I am scratching my head a little bit on how to write a test that informs this change, as I expect that the existing test cases should already cover it and should have caught it:

https://git.drupalcode.org/project/drupal/-/blob/9.0.x/core/modules/menu...

I'm assuming that the `drupalPostForm` actions don't generate the same query strings (in this case, the (?destination=). Is there a recommended way of designing a test that would encompass this use case?

My first thought was to build a menu test to step-wise walk-through the UI of creating, editing, and deleting a menu item through link clicks to see if that picks up the query strings.

(also apologies if this is a rudimentary query - this is my first dive into testing)

Webbeh’s picture

And lucky me, it looks like I answered my own question through snooping through the issue queue. #3164686: WebAssert::addressEquals() and AssertLegacyTrait::assertUrl() fail to check the querystring details a bug with querystrings not being parsed.

Do we need to defer this until #3164686: WebAssert::addressEquals() and AssertLegacyTrait::assertUrl() fail to check the querystring is resolved? Or, do we need to create an additional issue to refactor menu tests after the completion of #3164686: WebAssert::addressEquals() and AssertLegacyTrait::assertUrl() fail to check the querystring?

batkor’s picture

#14
Worked for me!
Drupal 8.9.2

Webbeh’s picture

#3164686: WebAssert::addressEquals() and AssertLegacyTrait::assertUrl() fail to check the querystring has been fixed, so we can now proceed with the work in #16 to enforce this via a test.

Webbeh’s picture

Status: Needs work » Needs review
StatusFileSize
new2.22 KB
new2.22 KB

Re-rolled #17 for 9.1.x and undo the malformed element.

patch: **** malformed patch at line 26: 2.20.1 (Apple Git-117)

I also took a stab at trying to add tests to better enforce this via the request in #19. There is a simple test of add/edit/remove a link from a menu with `core/modules/menu_ui/tests/src/Functional/MenuUiTest.php` that asserted whether the return URL after saving those changes returned to the correct routing. I added in additional coverage to additionally check to see if it's going back to where we expect - the menu edit page.

For review.

(apologies if I messed something up with the patch - this is my first core patch, so it's a little different than my usual day-to-day contrib)

e: Scratch that, it looks like my patch did not include the changes from #17 like I thought I did... d'oh. Cancelled test and let me see if I can unbork my local environment ingestion of #17.

Webbeh’s picture

StatusFileSize
new3.41 KB

Manually incorporated #17 into the work of #24, this now should encompass the work of this issue so far and can be more gracefully interdiff'd and built upon moving forward (without malforming).

(e: this patch may need reformatting for commit, apologies)

Status: Needs review » Needs work

The last submitted patch, 25: drupal-2305353-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Webbeh’s picture

Ah, the single failure likely came from the random .orig files that got pruned during the patch creation process:

[2305353-new 40acd57d98] 2305353-new
4 files changed, 9 insertions(+), 4 deletions(-)
delete mode 100644 core/modules/system/tests/fixtures/HtaccessTest/access_test.module.orig
delete mode 100644 core/modules/system/tests/fixtures/HtaccessTest/access_test.php.orig

e: Oh, I see. I have a local script that prunes bad files like this prior to commits, welp. Let me revise that.

Webbeh’s picture

Status: Needs work » Needs review
StatusFileSize
new3 KB

Re-rolled #27 with the removal of the unnecessary file deletions.

amietpatial’s picture

StatusFileSize
new56.99 KB

@Webbeh after applying your patch, I observed that if Parent is edited and saved first then the flow is fine but if you edit child first and save then the same redirection issue persists.

Please refer to screenshot.

amietpatial’s picture

Status: Needs review » Needs work
Webbeh’s picture

@Webbeh after applying your patch, I observed that if Parent is edited and saved first then the flow is fine but if you edit child first and save then the same redirection issue persists.

Thanks for the feedback, testing, and edge-case testing!

Looks like we may need to refine the fix outlined in #14/#17 and re-rolled in #28.

Additionally, your comment suggests that I'll need to make a stronger test-case that is more encompassing of more menu item permutations to ensure this functionality is working as-expected. I suppose this provides a use-case for spinning this out into its own test function, rather than sitting inside of an existing menu UI test.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

maosmurf’s picture

Hi, this issue does look like a duplicate of https://www.drupal.org/project/drupal/issues/2975407 and https://www.drupal.org/project/drupal/issues/2957953 to me. Both are not really solved yet, though.

batkor’s picture

StatusFileSize
new649 bytes

Hi
I'm update patch and changed "point" for change destination.
Please check patch

batkor’s picture

Status: Needs work » Needs review

#amietpatial check new patch. Solves your problem.

batkor’s picture

Patch from this issues
woked for my. Drupal 9.2.0-dev.
And closed all problems referenced this issues.

pameeela’s picture

Status: Needs review » Closed (duplicate)

Hi all,

This is a duplicate of #2957953: Editing menus user-experience has regressed and that has had a bit more activity, so I'm going to close this one to avoid any further duplication of effort.

I will add credit for all contributors here to get credit when it is fixed.

@baktor, can you please upload your last patch to the other issue?

pameeela’s picture