Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / layout_builder / src / Form / RemoveSectionForm.php
diff --git a/web/core/modules/layout_builder/src/Form/RemoveSectionForm.php b/web/core/modules/layout_builder/src/Form/RemoveSectionForm.php
new file mode 100644 (file)
index 0000000..aa58a3b
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\layout_builder\Form;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\layout_builder\SectionStorageInterface;
+
+/**
+ * Provides a form to confirm the removal of a section.
+ *
+ * @internal
+ */
+class RemoveSectionForm extends LayoutRebuildConfirmFormBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFormId() {
+    return 'layout_builder_remove_section';
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getQuestion() {
+    return $this->t('Are you sure you want to remove this section?');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getConfirmText() {
+    return $this->t('Remove');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function handleSectionStorage(SectionStorageInterface $section_storage, FormStateInterface $form_state) {
+    $section_storage->removeSection($this->delta);
+  }
+
+}