From c4f166aa2669763e1f221f5f1e803f27f948dfe7 Mon Sep 17 00:00:00 2001 From: Hugo Ribeiro Date: Fri, 1 Aug 2025 16:51:38 +0100 Subject: [PATCH 1/2] Templates paths to override in a theme --- docs/guides/templates/index.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/guides/templates/index.md b/docs/guides/templates/index.md index 37ea64d4c..c2bd278f5 100644 --- a/docs/guides/templates/index.md +++ b/docs/guides/templates/index.md @@ -528,6 +528,22 @@ Templates can be overridden by a theme. 1. Copy the `ratingui.mustache` file into the newly created `theme/timtam/templates/mod_wiki` and edit it. You should see your changes immediately if theme designer mode is on. Templates are cached just like CSS, so if you are not using theme designer mode you will need to purge all caches to see the latest version of an edited template. If the template you are overriding contains a documentation comment it is recommended to remove it. It will still show the documentation in the template library. +### Paths for overriding templates + +#### Overriding a template from another plugin + +If you want to override `theme/boost/templates/navbar.mustache`, you should copy and modify it, then **save the new version at** `theme/mytheme/templates/theme_boost/navbar.mustache`. + +This principle applies to other plugins. For example, to override the template at `blocks/myoverview/templates/view-summary.mustache` you would place your own at `theme/mytheme/templates/block_myoverview/view-summary.mustache`. + +#### Overriding a template from lib/ + +To override a core template, like, `lib/templates/notification_success.mustache:` you should have your own copy at `theme/mytheme/templates/core/notification_success.mustache`. + +#### Overriding a core subsystem template + +To override a core subsystem template, for example, `message/templates/message_preferences.mustache` place your template at `theme/mytheme/templates/core_message/message_preferences.mustache`. + ## Documenting the templates Theme designers need to know the limits of what they can expect to change without breaking anything. Also, correctly documented templates can be previewed in the "Template library" tool shipped with Moodle. From 2fbae8cc851152b29e7e3916ac9e7bd26673e1bc Mon Sep 17 00:00:00 2001 From: Hugo Ribeiro Date: Thu, 21 Aug 2025 22:37:59 +0100 Subject: [PATCH 2/2] [docs]Theme overriding examples table --- docs/guides/templates/index.md | 23 +++++++------------ .../version-4.1/guides/templates/index.md | 9 ++++++++ .../version-4.4/guides/templates/index.md | 9 ++++++++ .../version-4.5/guides/templates/index.md | 9 ++++++++ .../version-5.0/guides/templates/index.md | 9 ++++++++ 5 files changed, 44 insertions(+), 15 deletions(-) diff --git a/docs/guides/templates/index.md b/docs/guides/templates/index.md index c2bd278f5..0ba386ad0 100644 --- a/docs/guides/templates/index.md +++ b/docs/guides/templates/index.md @@ -528,21 +528,14 @@ Templates can be overridden by a theme. 1. Copy the `ratingui.mustache` file into the newly created `theme/timtam/templates/mod_wiki` and edit it. You should see your changes immediately if theme designer mode is on. Templates are cached just like CSS, so if you are not using theme designer mode you will need to purge all caches to see the latest version of an edited template. If the template you are overriding contains a documentation comment it is recommended to remove it. It will still show the documentation in the template library. -### Paths for overriding templates - -#### Overriding a template from another plugin - -If you want to override `theme/boost/templates/navbar.mustache`, you should copy and modify it, then **save the new version at** `theme/mytheme/templates/theme_boost/navbar.mustache`. - -This principle applies to other plugins. For example, to override the template at `blocks/myoverview/templates/view-summary.mustache` you would place your own at `theme/mytheme/templates/block_myoverview/view-summary.mustache`. - -#### Overriding a template from lib/ - -To override a core template, like, `lib/templates/notification_success.mustache:` you should have your own copy at `theme/mytheme/templates/core/notification_success.mustache`. - -#### Overriding a core subsystem template - -To override a core subsystem template, for example, `message/templates/message_preferences.mustache` place your template at `theme/mytheme/templates/core_message/message_preferences.mustache`. +### Examples + +| Path for original template | Component | Theme override path | +| --- | --- | --- | +| `public/blocks/myoverview/templates/view-summary.mustache` | `block_myoverview` | `public/theme/mytheme/templates/block_myoverview/view-summary.mustache` | +| `public/group/templates/group_details.mustache` | `core_group` | `public/theme/mytheme/templates/core_group/group_details.mustache` | +| `public/lib/templates/modal.mustache` | `core` | `public/theme/mytheme/templates/core/modal.mustache` | +| `public/theme/boost/templates/navbar.mustache` | `theme_boost` | `public/theme/mytheme/templates/theme_boost/navbar.mustache` | ## Documenting the templates diff --git a/versioned_docs/version-4.1/guides/templates/index.md b/versioned_docs/version-4.1/guides/templates/index.md index 37ea64d4c..fe1d28432 100644 --- a/versioned_docs/version-4.1/guides/templates/index.md +++ b/versioned_docs/version-4.1/guides/templates/index.md @@ -528,6 +528,15 @@ Templates can be overridden by a theme. 1. Copy the `ratingui.mustache` file into the newly created `theme/timtam/templates/mod_wiki` and edit it. You should see your changes immediately if theme designer mode is on. Templates are cached just like CSS, so if you are not using theme designer mode you will need to purge all caches to see the latest version of an edited template. If the template you are overriding contains a documentation comment it is recommended to remove it. It will still show the documentation in the template library. +### Examples + +| Path for original template | Component | Theme override path | +| --- | --- | --- | +| `blocks/myoverview/templates/view-summary.mustache` | `block_myoverview` | `theme/mytheme/templates/block_myoverview/view-summary.mustache` | +| `group/templates/group_details.mustache` | `core_group` | `theme/mytheme/templates/core_group/group_details.mustache` | +| `lib/templates/modal.mustache` | `core` | `theme/mytheme/templates/core/modal.mustache` | +| `theme/boost/templates/navbar.mustache` | `theme_boost` | `theme/mytheme/templates/theme_boost/navbar.mustache` | + ## Documenting the templates Theme designers need to know the limits of what they can expect to change without breaking anything. Also, correctly documented templates can be previewed in the "Template library" tool shipped with Moodle. diff --git a/versioned_docs/version-4.4/guides/templates/index.md b/versioned_docs/version-4.4/guides/templates/index.md index 37ea64d4c..fe1d28432 100644 --- a/versioned_docs/version-4.4/guides/templates/index.md +++ b/versioned_docs/version-4.4/guides/templates/index.md @@ -528,6 +528,15 @@ Templates can be overridden by a theme. 1. Copy the `ratingui.mustache` file into the newly created `theme/timtam/templates/mod_wiki` and edit it. You should see your changes immediately if theme designer mode is on. Templates are cached just like CSS, so if you are not using theme designer mode you will need to purge all caches to see the latest version of an edited template. If the template you are overriding contains a documentation comment it is recommended to remove it. It will still show the documentation in the template library. +### Examples + +| Path for original template | Component | Theme override path | +| --- | --- | --- | +| `blocks/myoverview/templates/view-summary.mustache` | `block_myoverview` | `theme/mytheme/templates/block_myoverview/view-summary.mustache` | +| `group/templates/group_details.mustache` | `core_group` | `theme/mytheme/templates/core_group/group_details.mustache` | +| `lib/templates/modal.mustache` | `core` | `theme/mytheme/templates/core/modal.mustache` | +| `theme/boost/templates/navbar.mustache` | `theme_boost` | `theme/mytheme/templates/theme_boost/navbar.mustache` | + ## Documenting the templates Theme designers need to know the limits of what they can expect to change without breaking anything. Also, correctly documented templates can be previewed in the "Template library" tool shipped with Moodle. diff --git a/versioned_docs/version-4.5/guides/templates/index.md b/versioned_docs/version-4.5/guides/templates/index.md index 37ea64d4c..fe1d28432 100644 --- a/versioned_docs/version-4.5/guides/templates/index.md +++ b/versioned_docs/version-4.5/guides/templates/index.md @@ -528,6 +528,15 @@ Templates can be overridden by a theme. 1. Copy the `ratingui.mustache` file into the newly created `theme/timtam/templates/mod_wiki` and edit it. You should see your changes immediately if theme designer mode is on. Templates are cached just like CSS, so if you are not using theme designer mode you will need to purge all caches to see the latest version of an edited template. If the template you are overriding contains a documentation comment it is recommended to remove it. It will still show the documentation in the template library. +### Examples + +| Path for original template | Component | Theme override path | +| --- | --- | --- | +| `blocks/myoverview/templates/view-summary.mustache` | `block_myoverview` | `theme/mytheme/templates/block_myoverview/view-summary.mustache` | +| `group/templates/group_details.mustache` | `core_group` | `theme/mytheme/templates/core_group/group_details.mustache` | +| `lib/templates/modal.mustache` | `core` | `theme/mytheme/templates/core/modal.mustache` | +| `theme/boost/templates/navbar.mustache` | `theme_boost` | `theme/mytheme/templates/theme_boost/navbar.mustache` | + ## Documenting the templates Theme designers need to know the limits of what they can expect to change without breaking anything. Also, correctly documented templates can be previewed in the "Template library" tool shipped with Moodle. diff --git a/versioned_docs/version-5.0/guides/templates/index.md b/versioned_docs/version-5.0/guides/templates/index.md index 37ea64d4c..fe1d28432 100644 --- a/versioned_docs/version-5.0/guides/templates/index.md +++ b/versioned_docs/version-5.0/guides/templates/index.md @@ -528,6 +528,15 @@ Templates can be overridden by a theme. 1. Copy the `ratingui.mustache` file into the newly created `theme/timtam/templates/mod_wiki` and edit it. You should see your changes immediately if theme designer mode is on. Templates are cached just like CSS, so if you are not using theme designer mode you will need to purge all caches to see the latest version of an edited template. If the template you are overriding contains a documentation comment it is recommended to remove it. It will still show the documentation in the template library. +### Examples + +| Path for original template | Component | Theme override path | +| --- | --- | --- | +| `blocks/myoverview/templates/view-summary.mustache` | `block_myoverview` | `theme/mytheme/templates/block_myoverview/view-summary.mustache` | +| `group/templates/group_details.mustache` | `core_group` | `theme/mytheme/templates/core_group/group_details.mustache` | +| `lib/templates/modal.mustache` | `core` | `theme/mytheme/templates/core/modal.mustache` | +| `theme/boost/templates/navbar.mustache` | `theme_boost` | `theme/mytheme/templates/theme_boost/navbar.mustache` | + ## Documenting the templates Theme designers need to know the limits of what they can expect to change without breaking anything. Also, correctly documented templates can be previewed in the "Template library" tool shipped with Moodle.