Overriding question bank view class 3.0

Overriding question bank view class 3.0

by Michael Ko -
Number of replies: 3

H (not sure if this is more of a theme or quiz question) but:

I know that it is possible to override namespace renderers (and we have overridden mod_quiz_renderer in our theme), but I am trying to override \core_question\bank\view (basically adding one more column to the table).

We need to make some changes to the questions list table that is displayed in both:

  • The list of questions in the question bank
  • The list of questions when adding a question to a quiz, that comes from AJAX, made by Tim Hunt

Is it possible to override \core_question\bank\view, as it does not seem to be part of an "output" namespace?

Thanks


Average of ratings: -
In reply to Michael Ko

Re: Overriding question bank view class 3.0

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You cannot override those classes using the theme renderer override mechanism, because they are not renderers.

There is some flexibility built into these classes, mainly through the $CFG->questionbankcolumns config variable. https://github.com/moodle/moodle/blob/master/question/classes/bank/view.php#L122

In reply to Tim Hunt

Re: Overriding question bank view class 3.0

by Michael Ko -

Hi Tim,

Thanks for your response.

We're now looking at the quiz edit page, which uses custom_view from namespace mod_quiz\question\bank, and we need to add another column - "Assigned Quizzes". In fact, in almost every teacher page that has some list of questions, we need to add a list of quizzes that they are assigned to.

I'm presuming that achieving this through extension is not possible, without writing some kind of hack?