EntityDeleteFormTrait::getRedirectUrl

protected EntityDeleteFormTrait::getRedirectUrl()

Returns the URL where the user should be redirected after deletion.

Return value

\Drupal\Core\Url The redirect URL.

File

core/lib/Drupal/Core/Entity/EntityDeleteFormTrait.php, line 95

Class

EntityDeleteFormTrait
Provides a trait for an entity deletion form.

Namespace

Drupal\Core\Entity

Code

protected function getRedirectUrl() {
  $entity = $this->getEntity();
  if ($entity->hasLinkTemplate('collection')) {
    // If available, return the collection URL.
    return $entity->urlInfo('collection');
  }
  else {
    // Otherwise fall back to the front page.
    return Url::fromRoute('<front>');
  }
}
doc_Drupal
2016-10-29 09:05:09
Comments
Leave a Comment

Please login to continue.