From bef6c3beee9080585f75ed1ea89f6650f4494a51 Mon Sep 17 00:00:00 2001
From: webchick <drupal@webchick.net>
Date: Mon, 2 Feb 2015 07:26:54 -0800
Subject: [PATCH] Issue #2416987 by YesCT, amateescu, webchick, Wim Leers,
 yched: Fix UI regression in the menu link form

---
 .../src/Plugin/Field/FieldWidget/LinkWidget.php | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php
index 0606f42b7bcc..e92fe538d71a 100644
--- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php
+++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php
@@ -169,12 +169,19 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
       '#attributes' => array('class' => array('link-field-widget-attributes')),
     );
 
-    // If cardinality is 1, ensure a label is output for the field by wrapping it
-    // in a details element.
+    // If cardinality is 1, ensure a proper label is output for the field.
     if ($this->fieldDefinition->getFieldStorageDefinition()->getCardinality() == 1) {
-      $element += array(
-        '#type' => 'fieldset',
-      );
+      // If the link title is disabled, use the field definition label as the
+      // title of the 'uri' element.
+      if ($this->getFieldSetting('title') == DRUPAL_DISABLED) {
+        $element['uri']['#title'] = $element['#title'];
+      }
+      // Otherwise wrap everything in a details element.
+      else {
+        $element += array(
+          '#type' => 'fieldset',
+        );
+      }
     }
 
     return $element;
-- 
GitLab