You are here

function theme_multichoice_form in Quiz 5

Same name and namespace in other branches
  1. 5.2 multichoice.module \theme_multichoice_form()
  2. 6.6 question_types/multichoice/multichoice.module \theme_multichoice_form()
  3. 6.2 multichoice.module \theme_multichoice_form()
  4. 6.3 question_types/multichoice/multichoice.module \theme_multichoice_form()
  5. 6.5 question_types/multichoice/multichoice.module \theme_multichoice_form()

Theme function for multichoice form

Lays out answer field elements into a table

Return value

string HTML output

1 theme call to theme_multichoice_form()
multichoice_form in ./multichoice.module
Implementation of hook_form().

File

./multichoice.module, line 490
Multiple choice question type for quiz module

Code

function theme_multichoice_form($form) {

  // Format table header
  $header = array(
    array(
      'data' => t('Correct'),
    ),
    array(
      'data' => t('Answer'),
      'style' => 'width:250px;',
    ),
    array(
      'data' => t('Feedback'),
      'style' => 'width:250px;',
    ),
    array(
      'data' => t('Delete'),
    ),
  );

  // Format table rows
  $rows = array();
  foreach (element_children($form) as $key) {
    $rows[] = array(
      drupal_render($form[$key]['correct']),
      drupal_render($form[$key]['answer']),
      drupal_render($form[$key]['feedback']),
      drupal_render($form[$key]['delete']),
    );
  }

  // Theme output and display to screen
  $output = theme('table', $header, $rows);
  return $output;
}