You are here

public function UserController::collectedData in General Data Protection Regulation 8.2

Same name and namespace in other branches
  1. 8 src/Controller/UserController.php \Drupal\gdpr\Controller\UserController::collectedData()
  2. 3.0.x src/Controller/UserController.php \Drupal\gdpr\Controller\UserController::collectedData()

Return the collected data for a user.

Parameters

\Drupal\user\UserInterface $user: The user.

Return value

array|\Symfony\Component\HttpFoundation\RedirectResponse Render array.

1 string reference to 'UserController::collectedData'
gdpr.routing.yml in ./gdpr.routing.yml
gdpr.routing.yml

File

src/Controller/UserController.php, line 82

Class

UserController
Class UserController.

Namespace

Drupal\gdpr\Controller

Code

public function collectedData(UserInterface $user) {
  if (!$this
    ->moduleHandler()
    ->moduleExists('gdpr_tasks') && !$this
    ->moduleHandler()
    ->moduleExists('gdpr_consent')) {
    return [
      '#markup' => $this
        ->t('Data stored about you.'),
    ];
  }
  if ($this
    ->moduleHandler()
    ->moduleExists('gdpr_tasks')) {
    return $this
      ->redirect('view.gdpr_tasks_my_data_requests.page_1', [
      'user' => $user
        ->id(),
    ]);
  }
  return $this
    ->redirect('gdpr_consent.agreements', [
    'user' => $user
      ->id(),
  ]);
}