public function GroupUnsubscribeConfirmForm::getCancelUrl in Organic groups 8
Returns the route to go to if the user cancels the action.
Return value
\Drupal\Core\Url A URL object.
Overrides ContentEntityDeleteForm::getCancelUrl
File
- src/
Form/ GroupUnsubscribeConfirmForm.php, line 45
Class
- GroupUnsubscribeConfirmForm
- Provides a confirmation form for unsubscribing form a group.
Namespace
Drupal\og\FormCode
public function getCancelUrl() {
/** @var EntityInterface $group */
$group = $this->entity
->getGroup();
// User doesn't have access to the group entity, so redirect to front page,
// otherwise back to the group entity.
return $group
->access('view') ? $group
->toUrl() : new Url('<front>');
}