Problem

Built-in menus hide their title widget since the title is not editable but they still expose the machine name in a non-editable widget. This is pointless, takes up valuable space at the top of the form and just makes the user wondering, clicking, frustrated.

Screenshot_2_25_13_11_49_AM.png

Proposal

Apply the same #access logic to the machine name that already applies to the label.

This issue came up in #663946: Merge "List links" page into "Edit menu" page.

Comments

gábor hojtsy’s picture

StatusFileSize
new1.4 KB
Bojhan’s picture

Screenshot of solution? removing it completely?

gábor hojtsy’s picture

Yeah, the solution starts the form with the Description field, no machine name displayed when not editable.

sun’s picture

Nitpick: Since the entire usage is negated, would it make sense to rename the variable to $is_custom_menu?

gábor hojtsy’s picture

Sure, that works too.

gábor hojtsy’s picture

StatusFileSize
new1.4 KB

Made that suggested change.

sun’s picture

+++ b/core/modules/menu/lib/Drupal/menu/MenuFormController.php
@@ -22,6 +22,7 @@ public function form(array $form, array &$form_state, EntityInterface $menu) {
+    $is_custom_menu = !isset($system_menus[$menu->id()]);

@@ -45,6 +46,8 @@ public function form(array $form, array &$form_state, EntityInterface $menu) {
       // A menu's machine name cannot be changed.
       '#disabled' => !$menu->isNew() || isset($system_menus[$menu->id()]),
+      // The machine name of a system menu cannot be altered.
+      '#access' => $is_custom_menu,

The #disabled condition right above the touched line could use the new !$is_custom_menu, too (this time, negated).

David_Rothstein’s picture

Duplicate of #945654: Default menus have hardcoded titles which cannot be edited?

My idea there was just to let the built-in menu labels be edited, and it seemed to work fine at the time (but it was a long time ago). I don't think there's any reason they shouldn't be editable.

Bojhan’s picture

Maybe this is a can of worms, but why cant you just edit this? I always thought that the title should be editable, and the machine name could be locked.

gábor hojtsy’s picture

Status: Needs review » Needs work

Yeah so in #945654: Default menus have hardcoded titles which cannot be edited David proposes we make it editable (and properly inherit titles to the blocks). The use of the title inheritance is outdated (and currently not possible due to #1926736: Allow block titles to be automatically tied to the underlying object). So we can also just remove the #access line from the title and be done with it :)

gábor hojtsy’s picture

Status: Needs work » Closed (duplicate)
gábor hojtsy’s picture

Issue summary: View changes

Explain where this comes from.