You are here

function quiz_views_data_alter in Quiz 6.x

Same name and namespace in other branches
  1. 8.6 includes/views/quiz.views.inc \quiz_views_data_alter()
  2. 8.5 includes/views/quiz.views.inc \quiz_views_data_alter()
  3. 7.6 includes/views/quiz.views.inc \quiz_views_data_alter()
  4. 7.5 includes/views/quiz.views.inc \quiz_views_data_alter()

Implements hook_views_data_alter().

Add the wildcard Quiz result answer fields to Views.

File

./quiz.module, line 579
Contains quiz.module

Code

function quiz_views_data_alter(&$data) {
  $data['quiz_result']['quiz_result_answers'] = [
    'title' => 'All answers',
    'help' => 'Display all answers for a Quiz result in separate columns.',
    'field' => [
      'id' => 'quiz_result_answers',
    ],
  ];
  $data['quiz_result']['quiz_result_answer'] = [
    'title' => 'Single answers',
    'help' => 'Display an answer for a specific question in a Quiz result.',
    'field' => [
      'id' => 'quiz_result_answer',
    ],
  ];
}