You are here

function coder_form_alter in Coder 6.2

Same name and namespace in other branches
  1. 5.2 coder.module \coder_form_alter()
  2. 5 coder.module \coder_form_alter()
  3. 6 coder.module \coder_form_alter()

Implementation of hook_form_alter().

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

File

./coder.module, line 158

Code

function coder_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')) {
      $path = drupal_get_path('module', 'coder');
      drupal_add_css($path . '/coder.css', 'module');
      foreach ($form['name'] as $name => $data) {
        $description = isset($form['description'][$name]['#value']) ? $form['description'][$name]['#value'] : $data['#value'];
        $form['description'][$name]['#value'] = $description . ' (' . l(t('Code Review'), "coder/{$name}") . ')';
      }
    }
  }
}