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

CommentFileSizeAuthor
screen2.png12.64 KBfalco010
screen1.png12.85 KBfalco010

Comments

Falco010 created an issue. See original summary.

djdevin’s picture

Version: 7.x-5.0-alpha10 » 7.x-5.x-dev
Category: Bug report » Feature request

Wouldn'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.

falco010’s picture

Your 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

djdevin’s picture

Great, that's what I meant :p

Leaving this open as that hook is not yet documented.

djdevin’s picture

Status: Active » Fixed

  • djdevin committed 9b8fb19 on 7.x-5.x
    Issue #2581237 by djdevin: Document hook_quiz_feedback_labels_alter
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.