You are here

function hook_data_policy_destination_alter in Data Policy 8

Alter the data policy destination before performing the redirect.

Parameters

\Drupal\Core\Session\AccountProxyInterface $current_user: The current user.

\Drupal\Core\Routing\RedirectDestinationInterface $destination: The original destination parameter.

Return value

\Drupal\Core\Routing\RedirectDestinationInterface An altered data policy destination url.

1 invocation of hook_data_policy_destination_alter()
RedirectSubscriber::doRedirect in src/RedirectSubscriber.php
Do redirect to the agreement page.

File

./data_policy.api.php, line 19
Documentation for Data Policy API.

Code

function hook_data_policy_destination_alter(\Drupal\Core\Session\AccountProxyInterface $current_user, \Drupal\Core\Routing\RedirectDestinationInterface $destination) {
  if ($current_user
    ->isAnonymous()) {
    $destination
      ->set('/user/login');
  }
  return $destination;
}