You are here

function _tidy_question in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/questionlib.php \_tidy_question()

Private function to factor common code out of get_question_options().

Parameters

object $question the question to tidy.:

Return value

boolean true if successful, else false.

1 call to _tidy_question()
get_question_options in includes/moodle/lib/questionlib.php
Updates the question objects with question type specific information by calling {@link get_question_options()}

File

includes/moodle/lib/questionlib.php, line 759

Code

function _tidy_question(&$question) {
  global $QTYPES;
  if (!array_key_exists($question->qtype, $QTYPES)) {
    $question->qtype = 'missingtype';
    $question->questiontext = '<p>' . get_string('warningmissingtype', 'quiz') . '</p>' . $question->questiontext;
  }
  $question->name_prefix = question_make_name_prefix($question->id);
  return $QTYPES[$question->qtype]
    ->get_question_options($question);
}