You are here

function gdpr_get_modules in General Data Protection Regulation 3.0.x

Returns cached module data from module info files.

Return value

array Array of module data

2 calls to gdpr_get_modules()
gdpr_get_gdpr_module_description in ./gdpr.module
Returns a HTML markup for gdpr_modules checkpoint description.
gdpr_get_module_list in ./gdpr.module
Returns a HTML markup for data_collecting modules checkpoint description.

File

./gdpr.module, line 451
Module file.

Code

function gdpr_get_modules() {
  $cache = Drupal::cache()
    ->get('modules.list');
  if (!empty($cache->data)) {
    return $cache->data;
  }
  $modules_list_raw = Drupal::service('extension.list.module')
    ->getList();
  $modules_list = [];
  foreach ($modules_list_raw as $module) {
    $modules_list[$module
      ->getName()] = [
      'status' => $module->status,
      'name' => $module->info['name'],
    ];
  }
  Drupal::cache()
    ->set('modules.list', $modules_list);
  return $modules_list;
}