Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
i'm overriding theme_quiz_result because i feel the output is too verbose for my purposes. but i cant figure how to get the user's answer choice from there. $variables can yield which answer is correct but not which answer was chosen. any help please?
Comments
Comment #1
djdevinSince the result page is also the grading form (which may no longer be the case soon) it complicates things.
In that theme function you do have the $questions array but you will most likely have to do some manual work to get the chose answer out, because it gets passed to a form building function.
There is a method on each question response called "getReportFormResponse" which returns a standardized array for the display of feedback so you may be able to try that.
It's a hacky solution but I think it will have to do for now until we make that theme function more flexible so that the response data is directly available. Note that $response will include all question feedback regardless of the feedback settings on the quiz.
Comment #2
docwilmot CreditAttribution: docwilmot commentedgetting "Class name must be a valid object or a string" for line 739 in quiz_question.module when i run this code. 739 is