You are here

function theme_matching_response in Quiz 8.4

Same name and namespace in other branches
  1. 8.6 question_types/quiz_matching/theme/matching.theme.inc \theme_matching_response()
  2. 8.5 question_types/quiz_matching/theme/matching.theme.inc \theme_matching_response()
  3. 6.4 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  4. 7.6 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  5. 7 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  6. 7.4 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  7. 7.5 question_types/matching/theme/matching.theme.inc \theme_matching_response()

Theme the contents of the matching response form

Parameters

$metadata: Can be used as a table header

$data: Can be used as table rows

1 theme call to theme_matching_response()
MatchingResponse::getReportFormResponse in question_types/matching/lib/Drupal/matching/MatchingResponse.php
Implementation of getReportFormResponse

File

question_types/matching/matching.theme.inc, line 77
Themes for the matching module.

Code

function theme_matching_response($variables) {
  $metadata = $variables['metadata'];
  $data = $variables['data'];
  if (isset($data[0]['is_correct'])) {
    foreach ($data as $id => $match_data) {
      $theme = $match_data['is_correct'] ? 'quiz_score_correct' : 'quiz_score_incorrect';

      // TODO Please change this theme call to use an associative array for the $variables parameter.
      $data[$id]['is_correct'] = array(
        'data' => theme($theme),
        'class' => 'quiz_summary_qcell',
      );
    }
  }
  return theme('table', array(
    'header' => $metadata,
    'rows' => $data,
  ));
}