function theme_multichoice_answer_node_view in Quiz 8.6
Same name and namespace in other branches
- 8.4 question_types/multichoice/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 8.5 question_types/quiz_multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 6.4 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7.6 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7.4 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
- 7.5 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_answer_node_view()
Theme the answer part of the node view.
Parameters
array $variables:
Return value
string An HTML string representing the themed output.
1 theme call to theme_multichoice_answer_node_view()
- MultichoiceQuestion::getNodeView in question_types/
quiz_multichoice/ src/ Plugin/ quiz/ QuizQuestion/ MultichoiceQuestion.php - Implementation of getNodeView().
File
- question_types/
quiz_multichoice/ theme/ multichoice.theme.inc, line 16 - Theme functions for the multichoice question type.
Code
function theme_multichoice_answer_node_view($variables) {
$alternatives = $variables['alternatives'];
$show_correct = $variables['show_correct'];
$header = array(
'',
'',
);
foreach ($alternatives as $i => $short) {
$answer_markup = check_markup($short['answer']['value'], $short['answer']['format']);
// Find the is_correct status.
$is_correct = $short['score_if_chosen'] > $short['score_if_not_chosen'];
$image = $is_correct ? 'correct' : 'wrong';
if (!$show_correct) {
$image = 'unknown';
}
$rows[] = array(
array(
'width' => 64,
'data' => array(
'#theme' => 'html_tag',
'#tag' => 'span',
'#attributes' => array(
'class' => array(
'quiz-score-icon',
$image,
),
'title' => $show_correct ? t('Score if chosen: @sc Score if not chosen: @nc', array(
'@sc' => $short['score_if_chosen'],
'@nc' => $short['score_if_not_chosen'],
)) : t('You are not allowed to view the solution for this question'),
),
),
),
$answer_markup,
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}