You are here

function readmehelp_form_system_modules_alter in README Help 8

Implements hook_system_info_alter().

File

./readmehelp.module, line 41
Contains readmehelp.module.

Code

function readmehelp_form_system_modules_alter(&$form, FormStateInterface $form_state, $form_id) {
  foreach ($form['modules'] as $package => $modules) {
    if (is_array($modules)) {
      foreach ($modules as $module => $data) {
        if (is_array($data) && (isset($data['#requires']['readmehelp']) || $module == 'readmehelp')) {
          $help = t('README Help');
          $form['modules'][$package][$module]['links']['help'] = [
            '#type' => 'link',
            '#title' => $help,
            '#url' => Url::fromRoute('help.page', [
              'name' => $module,
            ]),
            '#options' => [
              'attributes' => [
                'class' => [
                  'module-link',
                  'module-link-help',
                ],
                'title' => $help,
              ],
            ],
          ];
        }
      }
    }
  }
}