class RemoveBlockForm
Same name and namespace in other branches
- 11.x core/modules/layout_builder/src/Form/RemoveBlockForm.php \Drupal\layout_builder\Form\RemoveBlockForm
- 10 core/modules/layout_builder/src/Form/RemoveBlockForm.php \Drupal\layout_builder\Form\RemoveBlockForm
- 8.9.x core/modules/layout_builder/src/Form/RemoveBlockForm.php \Drupal\layout_builder\Form\RemoveBlockForm
Provides a form to confirm the removal of a block.
@internal Form classes are internal.
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait
- class \Drupal\Core\Form\ConfirmFormBase implements \Drupal\Core\Form\ConfirmFormInterface extends \Drupal\Core\Form\FormBase
- class \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase uses \Drupal\Core\Ajax\AjaxFormHelperTrait, \Drupal\layout_builder\LayoutBuilderHighlightTrait, \Drupal\layout_builder\Controller\LayoutRebuildTrait extends \Drupal\Core\Form\ConfirmFormBase
- class \Drupal\layout_builder\Form\RemoveBlockForm extends \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase
- class \Drupal\layout_builder\Form\LayoutRebuildConfirmFormBase uses \Drupal\Core\Ajax\AjaxFormHelperTrait, \Drupal\layout_builder\LayoutBuilderHighlightTrait, \Drupal\layout_builder\Controller\LayoutRebuildTrait extends \Drupal\Core\Form\ConfirmFormBase
- class \Drupal\Core\Form\ConfirmFormBase implements \Drupal\Core\Form\ConfirmFormInterface extends \Drupal\Core\Form\FormBase
Expanded class hierarchy of RemoveBlockForm
1 string reference to 'RemoveBlockForm'
- layout_builder.routing.yml in core/
modules/ layout_builder/ layout_builder.routing.yml - core/modules/layout_builder/layout_builder.routing.yml
File
-
core/
modules/ layout_builder/ src/ Form/ RemoveBlockForm.php, line 14
Namespace
Drupal\layout_builder\FormView source
class RemoveBlockForm extends LayoutRebuildConfirmFormBase {
/**
* The current region.
*
* @var string
*/
protected $region;
/**
* The UUID of the block being removed.
*
* @var string
*/
protected $uuid;
/**
* {@inheritdoc}
*/
public function getQuestion() {
$label = $this->sectionStorage
->getSection($this->delta)
->getComponent($this->uuid)
->getPlugin()
->label();
return $this->t('Are you sure you want to remove the %label block?', [
'%label' => $label,
]);
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Remove');
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'layout_builder_remove_block';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL, $delta = NULL, $region = NULL, $uuid = NULL) {
$this->region = $region;
$this->uuid = $uuid;
return parent::buildForm($form, $form_state, $section_storage, $delta);
}
/**
* {@inheritdoc}
*/
protected function handleSectionStorage(SectionStorageInterface $section_storage, FormStateInterface $form_state) {
$section_storage->getSection($this->delta)
->removeComponent($this->uuid);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.