function _get_gdpr_module_description in General Data Protection Regulation 8
Same name and namespace in other branches
- 8.2 gdpr.module \_get_gdpr_module_description()
- 7 gdpr.module \_get_gdpr_module_description()
Returns a HTML markup for gdpr_modules checkpoint description.
Return value
string HTML markup string
1 call to _get_gdpr_module_description()
- gdpr_checklistapi_checklist_items in ./
gdpr.module - Callback for gdpr_checklistapi_checklist_info().
File
- ./
gdpr.module, line 264 - Module file.
Code
function _get_gdpr_module_description() {
$all_modules = _get_modules();
$renderer = \Drupal::service('renderer');
$gdpr_module_names = [
'gdpr_dump',
];
$gdpr_modules_list = [
'#theme' => 'item_list',
'#items' => [],
];
$module_statuses = _get_module_statuses();
$color_classes = [
-1 => 'admin-missing',
0 => 'admin-missing',
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' => $renderer
->renderPlain($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' => $renderer
->renderPlain($status),
]);
}
}
$gdpr_modules = $renderer
->renderPlain($gdpr_modules_list);
$options = [
'absolute' => TRUE,
];
$link = Link::createFromRoute(t('Enable them on Extend admin page'), 'system.modules_list', [], $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
->toString();
}
else {
return '';
}
}