ProfileDeleteForm.php in Profile 8
File
src/Form/ProfileDeleteForm.php
View source
<?php
namespace Drupal\profile\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;
use Drupal\Core\Url;
class ProfileDeleteForm extends ContentEntityDeleteForm {
public function getQuestion() {
return $this
->t('Are you sure you want to delete %label?', [
'%label' => $this
->getEntity()
->label(),
]);
}
protected function getDeletionMessage() {
$entity = $this
->getEntity();
return $this
->t('%label has been deleted.', [
'%label' => $entity
->label(),
]);
}
public function getCancelUrl() {
$entity = $this->entity;
if ($entity
->getOwnerId()) {
return Url::fromRoute('entity.user.canonical', [
'user' => $entity
->getOwnerId(),
]);
}
return Url::fromRoute('entity.profile.collection');
}
protected function getRedirectUrl() {
return $this
->getCancelUrl();
}
}