function gdpr_get_module_list in General Data Protection Regulation 3.0.x
Returns a HTML markup for data_collecting modules checkpoint description.
Parameters
string $type: Type of modules to search for.
Return value
string HTML markup string
1 call to gdpr_get_module_list()
- gdpr_checklistapi_checklist_items in ./
gdpr.module - Callback for gdpr_checklistapi_checklist_info().
File
- ./
gdpr.module, line 360 - Module file.
Code
function gdpr_get_module_list($type) {
$c_modules = gdpr_get_module_list_by_type($type);
$renderer = Drupal::service('renderer');
$modules_list = [
'#theme' => 'item_list',
'#items' => [],
];
$module_statuses = gdpr_get_module_statuses();
$all_modules = gdpr_get_modules();
$color_classes = [
-1 => 'admin-enabled',
0 => 'admin-enabled',
1 => 'admin-missing',
];
foreach ($c_modules as $c_module) {
if (isset($all_modules[$c_module])) {
$status_class = $color_classes[$all_modules[$c_module]['status']];
$status = [
'#prefix' => '<span class="' . $status_class . '">',
'#suffix' => '</span>',
'#markup' => $module_statuses[$all_modules[$c_module]['status']],
];
$modules_list['#items'][] = t('@title (@status)', [
'@title' => $all_modules[$c_module]['name'],
'@status' => $renderer
->renderPlain($status),
]);
}
}
return $renderer
->renderPlain($modules_list);
}