noticed in #1945226: Add language selector on menus
Updated: Comment #0
Problem/Motivation
The custom menu add form had a element to show the machine name while the title is being typed, after save, that machine name is not editable, but is shown on the edit menu form.
During creation (add), if the menu title is "hello" it shows the machine name will be hello. That's not what happens though, the machine name is actually "menu-hello", and "menu-hello" is what is shown after saving on edit of the menu
Proposed resolution
make the preview of the machine name match the actual machine name.
Remaining tasks
discuss a way to fix this.
User interface changes
No.
API changes
None anticipated.
Comments
Comment #1
tstoecklerFrom the referenced issue, something like the following should do the trick:
I think that should do it?!
Comment #2
mandarmbhagwat78 commentedComment #3
mandarmbhagwat78 commentedHere is the patch file attached
Comment #4
rszrama commentedThis appears to work just fine on Drupal 8; moving back to Drupal 7 where I can confirm the issue.
@mandarmbhagwat78 - fwiw, you shouldn't have any patches that just include commented out lines of code. If lines of code are no longer necessary, they should just be removed. : )
Comment #5
tstoecklerYeah in D8 this got fixed in #1945226: Add language selector on menus. Sorry for not updating this issue.
Comment #6
mandarmbhagwat78 commentedyep @rszrama will take care of that next time. :)
Comment #7
ethomas08 commentedTested on a fresh install of D7 -- patch worked perfectly.
Comment #8
poker10 commented+1 to patch #4. I think this issue is important, as the information is missing for the user. If we add this prefix, it would work the same way as in the Field UI (content type - manage fields form) - this part also uses the prefix when editing the field name manually.
Added screenshots how it looks like before and after the patch.
Comment #9
mcdruid commentedI'm not sure that this has really been "fixed" in D8/9?
Using the form at /admin/structure/menu/add looks like this:
...and the menu- prefix is not displayed in the edit form either once the menu has been saved:
What are we actually fixing here? Making the display of the machine name consistent with e.g. the D7 Fields UI as mentioned by @poker10?
Note that @YesCT also filed #2029197: remove enforced menu- prefix to custom menu machine names around the same time as this issue, but there's not been any activity on that.
Comment #10
poker10 commentedThe prefix was added in D8 in this issue: #1945226: Add language selector on menus and this commit: https://git.drupalcode.org/project/drupal/-/commit/0a0942a060ebe8413c69b4b6fff1723ddfa979bb, but was removed by this issue: #2084197: Uninstalling menu module removes all custom menus , where plugins have been unified (https://drupal.org/node/2086185).
In D9 this works OK, because if you create the menu (like you have on screenshots), the real menu name is as it is shown - still "foobar" (see also the URL after the menu is created "admin/structure/menu/manage/foobar").
But if you create a menu in D7, it shows the "foobar" when creating, but the real menu name after the menu is created is "menu-foobar" (see URL "admin/structure/menu/manage/menu-foobar"). This is the problem this issue is trying to fix. The menu name shown in the UI does not correspond with the real menu name created after saving the menu.
The issue #2029197: remove enforced menu- prefix to custom menu machine names seems no longer relevant for D9.
Comment #11
mcdruid commentedGreat, thanks for the detailed explanation and for closing that issue, which does indeed now seem to be outdated.
Comment #13
poker10 commentedThanks everyone!