public function SubscriptionCancelForm::getCancelUrl in Mailing List 8
Returns the route to go to if the user cancels the action.
Return value
\Drupal\Core\Url A URL object.
Overrides ContentEntityDeleteForm::getCancelUrl
1 call to SubscriptionCancelForm::getCancelUrl()
- SubscriptionCancelForm::getRedirectUrl in src/
Form/ SubscriptionCancelForm.php - Returns the URL where the user should be redirected after deletion.
File
- src/
Form/ SubscriptionCancelForm.php, line 23
Class
- SubscriptionCancelForm
- Builds the form to cancel (delete) subscriptions.
Namespace
Drupal\mailing_list\FormCode
public function getCancelUrl() {
$url = parent::getCancelUrl();
// Try subscription page.
if (!$url
->access() && $this->entity) {
$url = $this->entity
->toUrl();
}
// Try user account subscriptions.
if (!$url
->access()) {
$url = Url::fromRoute('view.mailing_list_subscriptions.page_user_subscriptions_tab', [
'user' => $this
->currentUser()
->id(),
]);
}
// Fallback to home.
if (!$url
->access()) {
$url = Url::fromRoute('<front>');
}
return $url;
}