Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / outside_in / src / Block / BlockEntityOffCanvasForm.php
index 4e0f081fb5c840a14560cbcac263131b79f2e19d..f97f79ae05e51fb89129a283b5758de7281cb8e7 100644 (file)
@@ -44,7 +44,7 @@ class BlockEntityOffCanvasForm extends BlockForm {
     }
     $form['advanced_link'] = [
       '#type' => 'link',
-      '#title' => $this->t('Advanced options'),
+      '#title' => $this->t('Advanced block options'),
       '#url' => $this->entity->toUrl('edit-form', ['query' => $query]),
       '#weight' => 1000,
     ];
@@ -52,6 +52,18 @@ class BlockEntityOffCanvasForm extends BlockForm {
     // Remove the ID and region elements.
     unset($form['id'], $form['region'], $form['settings']['admin_label']);
 
+    if (isset($form['settings']['label_display']) && isset($form['settings']['label'])) {
+      // Only show the label input if the label will be shown on the page.
+      $form['settings']['label_display']['#weight'] = -100;
+      $form['settings']['label']['#states']['visible'] = [
+        ':input[name="settings[label_display]"]' => ['checked' => TRUE],
+      ];
+
+      // Relabel to "Block title" because on the front-end this may be confused
+      // with page title.
+      $form['settings']['label']['#title'] = $this->t("Block title");
+      $form['settings']['label_display']['#title'] = $this->t("Display block title");
+    }
     return $form;
   }