You are here

public function GroupSubscribeForm::getCancelUrl in Organic groups 8

Return the URL to redirect on cancel.

Return value

\Drupal\Core\Url The URL object to redirect to.

1 call to GroupSubscribeForm::getCancelUrl()
GroupSubscribeForm::actions in src/Form/GroupSubscribeForm.php

File

src/Form/GroupSubscribeForm.php, line 116

Class

GroupSubscribeForm
Provides a form for subscribing to a group.

Namespace

Drupal\og\Form

Code

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>');
}