t('Are you sure you want to delete migration group %label?', [ '%label' => $this->entity->label(), ]); } /** * Gather the confirmation text. * * @return string * Translated string. */ public function getConfirmText() { return $this->t('Delete Migration Group'); } /** * Gets the cancel URL. * * @return \Drupal\Core\Url * The URL to go to if the user cancels the deletion. */ public function getCancelUrl() { return new Url('entity.migration_group.list'); } /** * The submit handler for the confirm form. * * @param array $form * An associative array containing the structure of the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * An associative array containing the current state of the form. */ public function submitForm(array &$form, FormStateInterface $form_state) { // Delete the entity. $this->entity->delete(); // Set a message that the entity was deleted. drupal_set_message(t('Migration group %label was deleted.', [ '%label' => $this->entity->label(), ])); // Redirect the user to the list controller when complete. $form_state->setRedirectUrl($this->getCancelUrl()); } }