diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index 0606f42b7bcc7968261daa647b8d7233e16fe6fa..e92fe538d71a68f73d0545f35616f6be4d4d4588 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;