Builds the shortcut link deletion form.
Expanded class hierarchy of LinkDelete
class LinkDelete extends ConfirmFormBase {
/**
* The menu link to delete.
*
* @var \Drupal\menu_link\Plugin\Core\Entity\MenuLink
*/
protected $menuLink;
/**
* {@inheritdoc}
*/
public function getFormID() {
return 'shortcut_link_delete';
}
/**
* {@inheritdoc}
*/
protected function getQuestion() {
return t('Are you sure you want to delete the shortcut %title?', array(
'%title' => $this->menuLink->link_title,
));
}
/**
* {@inheritdoc}
*/
protected function getCancelPath() {
return 'admin/config/user-interface/shortcut/manage/' . $this->menuLink->menu_name;
}
/**
* {@inheritdoc}
*/
protected function getConfirmText() {
return t('Delete');
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, array &$form_state, MenuLink $menu_link = NULL) {
$this->menuLink = $menu_link;
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
menu_link_delete($this->menuLink->mlid);
$set_name = str_replace('shortcut-', '', $this->menuLink->menu_name);
$form_state['redirect'] = 'admin/config/user-interface/shortcut/manage/' . $set_name;
drupal_set_message(t('The shortcut %title has been deleted.', array(
'%title' => $this->menuLink->link_title,
)));
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 |
LinkDelete:: |
protected | property | The menu link to delete. | |
LinkDelete:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides ConfirmFormBase:: |
|
LinkDelete:: |
protected | function |
Returns the page to go to if the user cancels the action. Overrides ConfirmFormBase:: |
|
LinkDelete:: |
protected | function |
Returns a caption for the button that confirms the action. Overrides ConfirmFormBase:: |
|
LinkDelete:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
LinkDelete:: |
protected | function |
Returns the question to ask the user. Overrides ConfirmFormBase:: |
|
LinkDelete:: |
public | function |
Form submission handler. Overrides FormInterface:: |