Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-52366

$CFG->themedir not taken into account in 'get_template_directories_for_component' of 'mustache_template_finder'.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.4, 3.2.1
    • 2.9.3, 3.0, 3.1, 3.2
    • Themes
    • MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MDL-52366-master-mustachethemedir
    • Hide

      Ensure theme is installed in '$CFG->dirroot' /theme.

      Show
      Ensure theme is installed in '$CFG->dirroot' /theme.
    • Hide
      1. Add a non-standard location for additional themes into your config.php, e.g.
        $CFG->themedir = '/tmp/themedir';
      2. Install a new theme into that location (auto-installation is not supported for this location, you need to manually unzip the files there and maybe even purge caches so that moodle detects and installs it).
      3. Select that additional theme as the current site's theme
      4. Override a mustache template in that additional theme and make sure the overridden version is used. For example, added file
        $CFG->themedir/themename/templates/core/login.mustache
        should take precedence over the default
        $CFG->libdir/templates/login.mustache
      Show
      Add a non-standard location for additional themes into your config.php, e.g. $CFG->themedir = '/tmp/themedir'; Install a new theme into that location (auto-installation is not supported for this location, you need to manually unzip the files there and maybe even purge caches so that moodle detects and installs it). Select that additional theme as the current site's theme Override a mustache template in that additional theme and make sure the overridden version is used. For example, added file $CFG->themedir/themename/templates/core/login.mustache should take precedence over the default $CFG->libdir/templates/login.mustache

      Whilst looking at the code in the method 'get_template_directories_for_component' of the class 'mustache_template_finder' in /lib/classes/output/mustache_template_finder.php it reads:

      ....
              // Find the parent themes.
              $parents = array();
              if ($themename === $PAGE->theme->name) {
                  $parents = $PAGE->theme->parents;
              } else {
                  $themeconfig = theme_config::load($themename);
                  $parents = $themeconfig->parents;
              }
       
              // First check the theme.
              $dirs[] = $CFG->dirroot . '/theme/' . $themename . '/templates/' . $component . '/';
              // Now check the parent themes.
              // Search each of the parent themes second.
              foreach ($parents as $parent) {
                  $dirs[] = $CFG->dirroot . '/theme/' . $parent . '/templates/' . $component . '/';
              }
       
              $dirs[] = $compdirectory . '/templates/';
      ....
      

      But what is missing is checking to see if the theme is installed in $CFG->themedir. Thus as it currently stands any theme installed in $CFG->themedir would not have its overridden Mustache templates used.

            rdomagalski Rafał Domagalski
            gb2048 Gareth J Barnard
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            David Monllaó David Monllaó
            Damyon Wiese Damyon Wiese
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.