Mustache - use partial from another module's templates?

Re: Mustache - use partial from another module's templates?

by Gareth J Barnard -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Dave,

What theme are you using please?

But.... if you have a renderer in the activity that follows the standard inheritance tree for renderers that would have the 'get_mustache()' method then you can override that to use your own template loader that could cope with the partial format:

{{> theme_boost/core_form/element-button }}

as I've done something similar (and published on Moodle.org in my Foundation theme), see:

  1. https://github.com/gjb2048/moodle-theme_foundation/blob/master/classes/output/core/output/mustache_template_finder.php
  2. https://github.com/gjb2048/moodle-theme_foundation/blob/master/classes/output/mustache_engine.php#L74
  3. https://github.com/gjb2048/moodle-theme_foundation/blob/master/classes/output/core_renderer.php#L39
  4. https://github.com/moodle/moodle/blob/MOODLE_35_STABLE/lib/outputrenderers.php#L479
  5. https://github.com/moodle/moodle/blob/MOODLE_35_STABLE/lib/outputrenderers.php#L53
  6. https://github.com/moodle/moodle/blob/MOODLE_35_STABLE/lib/outputrenderers.php#L80

G