Provides a deletion confirmation form for the block instance deletion form.
Expanded class hierarchy of AdminBlockDeleteForm
class AdminBlockDeleteForm extends ConfirmFormBase {
/**
* The block being deleted.
*
* @var \Drupal\block\Plugin\Core\Entity\Block
*/
protected $block;
/**
* {@inheritdoc}
*/
public function getFormID() {
return 'block_admin_block_delete_form';
}
/**
* {@inheritdoc}
*/
protected function getQuestion() {
return t('Are you sure you want to delete the block %name?', array(
'%name' => $this->block
->label(),
));
}
/**
* {@inheritdoc}
*/
protected function getCancelPath() {
return 'admin/structure/block';
}
/**
* {@inheritdoc}
*/
protected function getConfirmText() {
return t('Delete');
}
/**
* Implements \Drupal\Core\Form\FormInterface::buildForm().
*
* @param \Drupal\block\Plugin\Core\Entity\Block $block
* The block instance.
*/
public function buildForm(array $form, array &$form_state, Block $block = null) {
$this->block = $block;
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
$this->block
->delete();
drupal_set_message(t('The block %name has been removed.', array(
'%name' => $this->block
->label(),
)));
$form_state['redirect'] = 'admin/structure/block';
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AdminBlockDeleteForm:: |
protected | property | The block being deleted. | |
AdminBlockDeleteForm:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides ConfirmFormBase:: |
|
AdminBlockDeleteForm:: |
protected | function |
Returns the page to go to if the user cancels the action. Overrides ConfirmFormBase:: |
|
AdminBlockDeleteForm:: |
protected | function |
Returns a caption for the button that confirms the action. Overrides ConfirmFormBase:: |
|
AdminBlockDeleteForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
AdminBlockDeleteForm:: |
protected | function |
Returns the question to ask the user. Overrides ConfirmFormBase:: |
|
AdminBlockDeleteForm:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
ConfirmFormBase:: |
protected | function | Returns a caption for the link which cancels the action. | 2 |
ConfirmFormBase:: |
protected | function | Returns additional text to display as a description. | 10 |
ConfirmFormBase:: |
protected | function | Returns the internal name used to refer to the confirmation item. | |
ConfirmFormBase:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface:: |
1 |