You are here

function _coder_page_form_includes in Coder 5

Same name and namespace in other branches
  1. 5.2 coder.module \_coder_page_form_includes()
  2. 6.2 coder.module \_coder_page_form_includes()
  3. 6 coder.module \_coder_page_form_includes()
1 call to _coder_page_form_includes()
coder_page_form in ./coder.module

File

./coder.module, line 601
Developer Module that assists with code review and version upgrade that supports a plug-in extensible hook system so contributed modules can define additional review standards.

Code

function _coder_page_form_includes(&$form, $coder_args, $name, $files, $offset) {
  $stats = array();
  $coder_args['#name'] = $name;
  $weight = 0;
  foreach ($files as $file) {
    $filename = drupal_substr($file->filename, $offset);
    $coder_args['#filename'] = $filename;
    $results = do_coder_reviews($coder_args);
    $stats[$filename] = $results['#stats'];
    unset($results['#stats']);

    // output the results in a collapsible fieldset
    $form[$name][$filename] = array(
      '#type' => 'fieldset',
      '#title' => $filename,
      '#collapsible' => true,
      '#collapsed' => true,
      '#weight' => ++$weight,
    );
    if (empty($results)) {
      $results[] = t('No Problems Found');
    }
    else {
      $form[$name][$filename]['#collapsed'] = false;
      $form[$name]['#collapsed'] = false;
    }
    $form[$name][$filename]['output'] = array(
      '#value' => theme('coder', $name, $filename, $results),
    );
  }
  return $stats;
}