Totara Learn Open Discussions

Problem overriding deeply nested mustache template

 
SimpsonBrad
Problem overriding deeply nested mustache template
SimpsonBrad 发表于 2020年10月14日 Wednesday 09:35
小组 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
WallaceDave 发表于 2020年10月15日 Thursday 16:04
小组 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.

SimpsonBrad
Re: Problem overriding deeply nested mustache template
SimpsonBrad 发表于 2020年10月16日 Friday 13:35
小组 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.