You are here

function coder_review_form_alter in Coder 7

Implements hook_form_alter().

Modify the module display view by adding a Coder Review link to every module description.

File

coder_review/coder_review.module, line 196

Code

function coder_review_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'system_modules' && (!isset($form['#theme']) || $form['#theme'] != 'confirm_form')) {
    if (user_access('view code review')) {
      $form['#attached']['css'] = array(
        drupal_get_path('module', 'coder_review') . '/coder_review.css',
      );
      foreach ($form['modules'] as $package => $modules) {
        if (!preg_match('/^#/', $package)) {
          foreach ($modules as $name => $data) {
            if (!preg_match('/^#/', $name)) {
              $description = $data['description']['#markup'];
              $form['modules'][$package][$name]['description']['#markup'] = $description . ' (' . l(t('Code review'), "admin/config/development/coder/review/{$name}") . ')';
            }
          }
        }
      }
    }
  }
}