public static function TrueFalseResponse::viewsGetAnswers in Quiz 8.5
Same name and namespace in other branches
- 8.6 question_types/quiz_truefalse/src/Plugin/quiz/QuizQuestion/TrueFalseResponse.php \Drupal\quiz_truefalse\Plugin\quiz\QuizQuestion\TrueFalseResponse::viewsGetAnswers()
- 6.x question_types/quiz_truefalse/src/Plugin/quiz/QuizQuestion/TrueFalseResponse.php \Drupal\quiz_truefalse\Plugin\quiz\QuizQuestion\TrueFalseResponse::viewsGetAnswers()
Get answers for a question in a result.
This static method assists in building views for the mass export of question answers.
@todo maybe not needed in d8...?
Overrides QuizResultAnswerEntityTrait::viewsGetAnswers
See also
views_handler_field_prerender_list for the expected return value.
File
- question_types/
quiz_truefalse/ src/ Plugin/ quiz/ QuizQuestion/ TrueFalseResponse.php, line 85
Class
- TrueFalseResponse
- Extension of QuizQuestionResponse.
Namespace
Drupal\quiz_truefalse\Plugin\quiz\QuizQuestionCode
public static function viewsGetAnswers(array $result_answer_ids = array()) {
$items = array();
// foreach ($result_answer_ids as $result_answer_id) {
// $ra = entity_load_single('quiz_result_answer', $result_answer_id);
// $question = node_load($ra->question_nid, $ra->question_vid);
// /* @var $ra_i QuizQuestionResponse */
// $ra_i = _quiz_question_response_get_instance($ra->result_id, $question);
// $items[$ra->result_id][] = array('answer' => $ra_i->getResponse() ? t('True') : t('False'));
// }
return $items;
}