Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / path / src / Plugin / Field / FieldWidget / PathWidget.php
index 13ab1f10767c28f1e4ca26a772f2af5f83ccd8c0..090edd4a9d8f86f6a70b123699706c8167c839ef 100644 (file)
@@ -49,6 +49,27 @@ class PathWidget extends WidgetBase {
       '#type' => 'value',
       '#value' => $items[$delta]->langcode,
     ];
+
+    // If the advanced settings tabs-set is available (normally rendered in the
+    // second column on wide-resolutions), place the field as a details element
+    // in this tab-set.
+    if (isset($form['advanced'])) {
+      $element += [
+        '#type' => 'details',
+        '#title' => t('URL path settings'),
+        '#open' => !empty($items[$delta]->alias),
+        '#group' => 'advanced',
+        '#access' => $entity->get('path')->access('edit'),
+        '#attributes' => [
+          'class' => ['path-form'],
+        ],
+        '#attached' => [
+          'library' => ['path/drupal.path'],
+        ],
+      ];
+      $element['#weight'] = 30;
+    }
+
     return $element;
   }