You are here

gdpr.install in General Data Protection Regulation 8

Same filename and directory in other branches
  1. 8.2 gdpr.install
  2. 7 gdpr.install
  3. 3.0.x gdpr.install

Install file for the GDPR module.

File

gdpr.install
View source
<?php

/**
 * @file
 * Install file for the GDPR module.
 */
use Drupal\Core\Url;

/**
 * Implements hook_requirements().
 *
 * For the Status Report, return information about GDPR checklist status.
 */
function gdpr_requirements($phase) {
  $requirements = [];
  if ($phase === 'runtime' && ($definitions = checklistapi_get_checklist_info())) {
    $id = 'gdpr_checklist';
    if (isset($definitions[$id]) && ($checklist = checklistapi_checklist_load($id))) {
      $percent = round($checklist
        ->getPercentComplete());
      $requirements['gdpr_status'] = [
        'title' => t('GDPR Preparation'),
        'value' => t('Self assessment Checklist: <a href="@url">@percent% done</a>.', [
          '@percent' => $percent,
          '@url' => Url::fromRoute('checklistapi.checklists.gdpr_checklist')
            ->toString(),
        ]),
        'severity' => REQUIREMENT_INFO,
      ];
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
gdpr_requirements Implements hook_requirements().