+ 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");
+ }