You are here

function _get_gdpr_module_description in General Data Protection Regulation 7

Same name and namespace in other branches
  1. 8.2 gdpr.module \_get_gdpr_module_description()
  2. 8 gdpr.module \_get_gdpr_module_description()

Returns a HTML makrup for gdpr_modules checkpoint description.

Return value

string HTML markup string

1 call to _get_gdpr_module_description()
gdpr_checklistapi_checklist_info in ./gdpr.module
Implements hook_checklistapi_checklist_info().

File

./gdpr.module, line 372
Contains hook implementations and shared functions.

Code

function _get_gdpr_module_description() {
  $all_modules = _get_modules();
  $gdpr_module_names = [
    'gdpr_dump',
  ];
  $gdpr_modules_list = [
    '#theme' => 'item_list',
    '#items' => [],
  ];
  $module_statuses = _get_module_statuses();
  $color_classes = [
    -1 => 'admin-missing',
    0 => 'admin-disabled',
    1 => 'admin-enabled',
  ];
  foreach ($gdpr_module_names as $module_name) {
    if (isset($all_modules[$module_name])) {
      if (!$all_modules[$module_name]['status']) {
        $status_class = $color_classes[$all_modules[$module_name]['status']];
        $status = [
          '#prefix' => '<span class="' . $status_class . '">',
          '#suffix' => '</span>',
          '#markup' => $module_statuses[$all_modules[$module_name]['status']],
        ];
        $gdpr_modules_list['#items'][] = t('@title (!status)', [
          '@title' => $all_modules[$module_name]['name'],
          '!status' => drupal_render($status),
        ]);
      }
    }
    else {
      $status_class = $color_classes[-1];
      $status = [
        '#prefix' => '<span class="' . $status_class . '">',
        '#suffix' => '</span>',
        '#markup' => $module_statuses[-1],
      ];
      $gdpr_modules_list['#items'][] = t('@title (!status)', [
        '@title' => $module_name,
        '!status' => drupal_render($status),
      ]);
    }
  }
  $gdpr_modules = drupal_render($gdpr_modules_list);
  $options = [
    'absolute' => TRUE,
  ];
  $link = l(t('Enable them on Modules admin page'), '/admin/modules', $options);
  if (!empty($gdpr_modules_list['#items'])) {
    $text = t("In order to have a complete overview of the site functionalities, it's recommended to enable the following features as well:");
    return $text . $gdpr_modules . $link;
  }
  else {
    return '';
  }
}