Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / layout_builder / src / Form / RemoveBlockForm.php
1 <?php
2
3 namespace Drupal\layout_builder\Form;
4
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\layout_builder\SectionStorageInterface;
7
8 /**
9  * Provides a form to confirm the removal of a block.
10  *
11  * @internal
12  */
13 class RemoveBlockForm extends LayoutRebuildConfirmFormBase {
14
15   /**
16    * The current region.
17    *
18    * @var string
19    */
20   protected $region;
21
22   /**
23    * The UUID of the block being removed.
24    *
25    * @var string
26    */
27   protected $uuid;
28
29   /**
30    * {@inheritdoc}
31    */
32   public function getQuestion() {
33     return $this->t('Are you sure you want to remove this block?');
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function getConfirmText() {
40     return $this->t('Remove');
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   public function getFormId() {
47     return 'layout_builder_remove_block';
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
54     $this->region = $region;
55     $this->uuid = $uuid;
56     return parent::buildForm($form, $form_state, $section_storage, $delta);
57   }
58
59   /**
60    * {@inheritdoc}
61    */
62   protected function handleSectionStorage(SectionStorageInterface $section_storage, FormStateInterface $form_state) {
63     $section_storage->getSection($this->delta)->removeComponent($this->uuid);
64   }
65
66 }