function quiz_question_question_form in Quiz 6.6
Same name and namespace in other branches
- 6.3 question_types/quiz_question/quiz_question.module \quiz_question_question_form()
- 6.5 question_types/quiz_question/quiz_question.module \quiz_question_question_form()
Get the form to show to the user.
2 string references to 'quiz_question_question_form'
- quiz_question_render_question in question_types/
quiz_question/ quiz_question.module - Implementation of hook_render_question().
- quiz_question_view in question_types/
quiz_question/ quiz_question.module - Implementation of hook_view()
File
- question_types/
quiz_question/ quiz_question.module, line 228 - Quiz Question module. This module provides the basic facilities for adding quiz question types to a quiz. While you can create standard Quiz question types simply by implementing the appropriate hooks, this module provides a framework that makes…
Code
function quiz_question_question_form($context, $node) {
$form = _quiz_question_get_instance($node)
->getQuestionForm($node, $context);
if (_quiz_is_taking_context()) {
$quiz = menu_get_object();
if (!empty($quiz->backwards_navigation) && !empty($node->question_number)) {
$form['back'] = array(
'#type' => 'submit',
'#value' => t('Back'),
);
}
// Add navigation at the bottom:
// Submit button
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Next'),
);
/* TODO is skipping supporting?
if (empty($node->no_skip_button)) {
$form['op'] = array(
'#type' => 'submit',
'#value' => t('Skip'),
);
}
*/
}
else {
// reconstruct form so type is first (at top)
// TODO is there a better way? like unshift an assoc tuple?
$type = node_get_types('type', $node);
$newform['question_type'] = array(
'#type' => 'markup',
'#value' => '<div class="question_type_name">' . $type->name . '</div>',
);
$newform += $form;
$form = $newform;
if (!user_access('view quiz question solutions')) {
$form['tries'] = array(
'#type' => 'markup',
'#value' => '<br /> <em>Answers hidden</em>.',
);
}
}
return $form;
}