I am new to developing Moodle plugins and I have the requirement to create a new custom template that can be called from a block list and can link to a course.
I managed to implement the basic functionality, but now I am struggling to make the custom template look like the rest of the page. It looks like a plain HTML page without loading any of the theme's CSS and I am trying to add the theme's partials (header, footer and so on), which technically works, but nothing looks close to anything from the theme.
Is there anything I have to tell the plugin (or the theme) to make the template use the theme's CSS?
This is the template file:
<div class="block_pluginname_course">
{{> theme_space/head }}
<div id="page-wrapper" class="d-print-block">
{{{ output.standard_top_of_body_html }}}
{{> theme_space/navbar }}
<h1>{{course.fullname}}</h1>
<a href="{{course.viewurl}}">{{#str}}go_to_course, block_course_overview_page{{/str}}</a>
{{> theme_space/footer }}
{{{ output.standard_after_main_region_html }}}
</div>
</div>
Please tell me if I can provide more code to make it clearer.
As far as I understand what you're doing, your block plugin contains a custom page, for which you have shared the template.
If you want the page you have created to look like part of the Moodle site, with the current theme's styles, then you need to write something like this:
That should then produce a page with all the Moodle theme in place, but with your template content on it.
If that is not quite what you are looking for, then it might be worth sharing a link to your code (on github, or similar), so we can see your template in context.