You are here

function quiz_views_data_alter in Quiz 8.5

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

Implements hook_views_data_alter().

File

includes/views/quiz.views.inc, line 11
This file provides metadata to the Views 2 API for views integration.

Code

function quiz_views_data_alter(&$data) {
  $data['quiz_node_results_answers']['table']['join'] = array(
    'quiz_node_properties' => array(
      'left_table' => 'quiz_node_relationship',
      'left_field' => 'child_nid',
      'field' => 'question_nid',
      'extra' => 'quiz_node_results_answers.result_id = quiz_node_results.result_id',
    ),
  );
  $data['quiz_node_results']['answers'] = array(
    'title' => t('Answers'),
    'help' => t('When rendered, this field will be replaced by all the answers.'),
    'field' => array(
      'title' => 'Answers',
      'handler' => 'views_handler_field_custom',
    ),
  );
  $data['quiz_node_results']['answer'] = array(
    'title' => t('Answer'),
    'help' => t('When rendered, this field will be replaced by a requested answer.'),
    'field' => array(
      'title' => 'Answer',
      'handler' => 'quiz_views_handler_field_quiz_question_result_answer',
    ),
  );
}