You are here

function theme_multichoice_creation_form in Quiz 6.4

Same name and namespace in other branches
  1. 8.4 question_types/multichoice/multichoice.theme.inc \theme_multichoice_creation_form()
  2. 7.6 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_creation_form()
  3. 7 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_creation_form()
  4. 7.4 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_creation_form()
  5. 7.5 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_creation_form()

The theme file for multichoice.

Sponsored by: Norwegian Centre for Telemedicine Code: falcon

@file Theming functions for the multichoice question type.

File

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

Code

function theme_multichoice_creation_form($form) {
  $path = drupal_get_path('module', 'multichoice') . '/multichoice.js';
  drupal_add_js($path, 'module');

  // We open the settings fieldset if there is errors involving the choice_multi setting
  $errors = form_get_errors();
  if (isset($errors['choice_multi'])) {
    $form['settings']['#collapsed'] = FALSE;
  }

  // We open the alternative fieldsets if errors have been reported
  if ($errors) {
    for ($i = 0; is_array($form[$i]); $i++) {
      if (drupal_strlen(strip_tags($_POST['alternatives'][$i]['answer'])) > 0) {
        $form[$i]['#collapsed'] = FALSE;
      }
    }
  }
  return drupal_render($form);
}