You are here

function theme_multichoice_alternative_creation in Quiz 8.4

File

question_types/multichoice/multichoice.theme.inc, line 140
The theme file for multichoice.

Code

function theme_multichoice_alternative_creation($variables) {
  $form = $variables['form'];
  $form['#attached']['js'] = array(
    drupal_get_path('module', 'multichoice') . '/js/multichoice-alternative-creation.js',
  );
  $output = '';

  // Get the title from the checkbox, and then unset it. We will place it as a table header
  $title_correct = check_plain($form['correct']['#title']);
  unset($form['correct']['#title']);

  // We have to add the required symbol manually
  $suf = $form['answer']['#required'] ? '<SPAN CLASS="form-required"> *</SPAN>' : '';

  // We store the title for the answer section as well
  $title_answer = check_plain($form['answer']['#title']) . $suf;
  $form['answer']['#title'] = '';

  // Now we can render the table
  $row[] = drupal_render($form['correct']);
  $row[] = drupal_render($form['answer']);
  $rows[] = $row;
  $header[] = array(
    'data' => $title_correct,
  );
  $header[] = array(
    'data' => $title_answer,
  );
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));

  //These lines make things look alot beter if user only has one input format available:
  _quiz_format_mod($form['format']);
  _quiz_format_mod($form['advanced']['format']);
  _quiz_format_mod($form['advanced']['helper']['format']);
  $output .= drupal_render($form['format']);
  $output .= drupal_render($form['advanced']);
  return $output;
}