semantic_connector-8.x-1.1/src/Form/SemanticConnectorConnectionDeleteForm.php
src/Form/SemanticConnectorConnectionDeleteForm.php
<?php
/**
* @file
* Contains \Drupal\semantic_connector\Form\SemanticConnectorConnectionDeleteForm.
*/
namespace Drupal\semantic_connector\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class SemanticConnectorConnectionDeleteForm extends EntityConfirmFormBase{
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this->t('Are you sure you want to delete entity %name?', array('%name' => $this->entity->get('title')));
}
/**
* {@inheritdoc}
*
* If the delete command is canceled, return to the contact list.
*/
public function getCancelURL() {
return new Url('semantic_connector.overview');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Delete');
}
/**
* {@inheritdoc}
*
* Delete the entity and log the event. log() replaces the watchdog.
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this->getEntity();
$entity->delete();
$form_state->setRedirect('semantic_connector.overview');
}
}