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