Newer
Older
Alex Pott
committed
<?php
/**
* @file
* Contains \Drupal\taxonomy\Form\VocabularyDeleteForm.
*/
namespace Drupal\taxonomy\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
Dries Buytaert
committed
use Drupal\Core\Form\FormStateInterface;
Alex Pott
committed
/**
* Provides a deletion confirmation form for taxonomy vocabulary.
*/
class VocabularyDeleteForm extends EntityConfirmFormBase {
/**
* {@inheritdoc}
*/
Alex Pott
committed
public function getFormId() {
Alex Pott
committed
return 'taxonomy_vocabulary_confirm_delete';
}
/**
* {@inheritdoc}
*/
public function getQuestion() {
Angie Byron
committed
return $this->t('Are you sure you want to delete the vocabulary %title?', array('%title' => $this->entity->label()));
Alex Pott
committed
}
/**
* {@inheritdoc}
*/
public function getCancelUrl() {
Alex Pott
committed
return $this->entity->urlInfo('collection');
Alex Pott
committed
}
/**
* {@inheritdoc}
*/
public function getDescription() {
Angie Byron
committed
return $this->t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.');
Alex Pott
committed
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
Angie Byron
committed
return $this->t('Delete');
Alex Pott
committed
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
Alex Pott
committed
$this->entity->delete();
Angie Byron
committed
drupal_set_message($this->t('Deleted vocabulary %name.', array('%name' => $this->entity->label())));
$this->logger('taxonomy')->notice('Deleted vocabulary %name.', array('%name' => $this->entity->label()));
Alex Pott
committed
$form_state->setRedirectUrl($this->getCancelUrl());