You are here

function theme_multichoice_creation_form in Quiz 8.4

Same name and namespace in other branches
  1. 6.4 question_types/multichoice/theme/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()

@todo Please document this function.

See also

http://drupal.org/node/1354

File

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

Code

function theme_multichoice_creation_form($variables) {
  $form = $variables['form'];
  $form['#attached']['js'] = array(
    drupal_get_path('module', 'multichoice') . '/js/multichoice.js',
  );

  // 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; isset($form[$i]) && is_array($form[$i]); $i++) {
      if (drupal_strlen(strip_tags($_POST['alternatives'][$i]['answer']['value'])) > 0) {
        $form[$i]['#collapsed'] = FALSE;
      }
    }
  }
  return drupal_render_children($form);
}