Totara Learn Open Discussions

Problem overriding deeply nested mustache template

 
Brad Simpson
Problem overriding deeply nested mustache template
de Brad Simpson - Wednesday, 14 de October de 2020, 09:35
Grupo Partners

I'm trying to override a deeply nested template at /mod/assessment/classes/question/multichoice/templates/element_radios.mustache.  Do you know what the folder structure should be within the theme/mytheme/templates folder?  I've tried the following:

  • mod_assessment_classes_question_multichoice
  • mod_assessment_question_multichoice
  • mod_assessment > classes > question > multichoice
  • mod_assessment > question > multichoice

I have no problem overriding templates from /mod/assessment/templates, as those simply go in theme/mytheme/templates/mod_assessment.

Dave Wallace
Re: Problem overriding deeply nested mustache template
de Dave Wallace - Thursday, 15 de October de 2020, 16:04
Grupo Totara

Hey there Brad, are you able to confirm if `multichoice` is a sub-plugin, or simply a directory within mod_assessment?

I ask, because in theory you should be able to obtain the correct frankenstyle name for `multichoice` and then the override directory would be: `theme/mytheme/templates/frankenstyle_multichoicename`.

Maybe `multichoice` has a `version.php` file containing a component name which you should be able to use, or supply, as the frankenstyle name that is added to a flattened collection of plugins to allow overriding. It shouldn't matter whether it's a plugin or sub-plugin, but it needs to have that frankenstyle name.

That'd be our suggested first steps to identify/fix or confirm, let us know how you get on.

Brad Simpson
Re: Problem overriding deeply nested mustache template
de Brad Simpson - Friday, 16 de October de 2020, 13:35
Grupo Partners

Thanks for the help, Dave.  'multichoice' was indeed a sub-plugin with its own version.php file.  Looking at the component name there gave me the frankensense name to use for the template override.