Hi there,
I am currently working with version '7.x-5.0-alpha10+51-dev' and i really cant figure out how to correctly change the order of my result table columns.
In the images below you will find the current result table and the changed order result table.
I managed to find where in the core this order is set. In quiz/question_types/quiz_question/quiz_question/quiz_question.core.inc there is a function called 'getFeedback()' where you can find the labels for the result table. If I change this hardcoded order it changes on the frontend.
I am looking for a better/cleaner way to do this, because i dont want to change core code. Maybe with entity alter/view alter or a database query.
I have a custom module that extends the quiz contrib module where I do all my custom coding, altering and for custom quiz-report-form.tpl.php.
Many thanks in advance!
Falco
| Comment | File | Size | Author |
|---|---|---|---|
| screen2.png | 12.64 KB | falco010 | |
| screen1.png | 12.85 KB | falco010 |
Comments
Comment #2
djdevinWouldn't that be nice if you could re-order from the Quiz admin area? Seems like a reasonable request too.
There is some talk in #2386103: Decouple quiz result/scoring, this would make the results page easier to theme/override. But I think overriding the definitions themselves would work better.
In `quiz_get_feedback_options()` this list is defined from invocations of `hook_quiz_feedback_options()` and I believe you can alter it by implementing `hook_quiz_feedback_options_alter(&$feedback_options)` in your custom module.
You can then change $feedback_options entirely to reflect your custom order and I think this should affect the order in which they display.
Comment #3
falco010Your suggestion to use `hook_quiz_feedback_options_alter` doesn't chance the order of the columns. I saw that in quiz_question.core.inc drupal_alter('quiz_feedback_labels') is called so I created hook_quiz_feedback_labels_alter and that did the job for me!
Thank you for your suggestion and quick response tho!
Greetings
Falco
Comment #4
djdevinGreat, that's what I meant :p
Leaving this open as that hook is not yet documented.
Comment #5
djdevin