Linked Questions

Popular Questions

How to tell custom Moodle plugin to use theme?

Asked by At

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 }}


    <a href="{{course.viewurl}}">{{#str}}go_to_course, block_course_overview_page{{/str}}</a>

    {{> theme_space/footer }}

    {{{ output.standard_after_main_region_html }}}


Please tell me if I can provide more code to make it clearer.

Related Questions