diff --git a/lib/classes/route/api/templates.php b/lib/classes/route/api/templates.php index 867c145e026..171baa96b20 100644 --- a/lib/classes/route/api/templates.php +++ b/lib/classes/route/api/templates.php @@ -44,7 +44,7 @@ class templates { * @return payload_response */ #[route( - path: '/templates/{themename}/{component}/{identifier}', + path: '/templates/{themename}/{component}/{identifier:.*}', method: ['GET'], title: 'Fetch a single template', description: 'Fetch a single template for a component in a theme', diff --git a/lib/tests/route/api/templates_test.php b/lib/tests/route/api/templates_test.php index 4e63e7f14ec..eefbcdddbe2 100644 --- a/lib/tests/route/api/templates_test.php +++ b/lib/tests/route/api/templates_test.php @@ -64,7 +64,17 @@ final class templates_test extends route_testcase { ['core/modal'], [], ], - 'foo' => [ + 'fetch nested template' => [ + 'boost/core/local/modal/alert', + [ + 'core/local/modal/alert', + 'core/modal', + ], + [ + 'moodle/ok', + ], + ], + 'multiple templates' => [ 'boost/core/notification', [ 'core/notification',