Course theme override parent's layout

Course theme override parent's layout

by Nicolas Dalpe -
Number of replies: 1

Hi Everyone,

I am having a problem with a course theme. When I set the course theme in my course setting I loose the changes made to my parent's layout files.

Setup:

Main theme: RemUI
Child theme: MyTheme - $THEME->parents = ['remui'];
Course theme: CourseTheme - $THEME->parents = ['remui', 'MyTheme'];

In MyTheme, I overwrite 2 layout files but as soon as I set the CourseTheme in the course setting the layout are back to the parent theme (without the MyTheme modification).

I didn't find a lot of documentation on course theme or grand child theme so I don't know if there is any special setting for child course.

Any idea why the modification get lost with the grand child theme?

I hope I am being clear

Thank you in advance for your help

I am using Moodle 3.7.2 with RemUI theme 3.7.3


Average of ratings: -
In reply to Nicolas Dalpe

Re: Course theme override parent's layout

by Nicolas Dalpe -
Problem solved. I had to specify the which theme to override the layout from.

In the grand-child theme:
$THEME->layouts = [
    // Main course page.
    'course' => array(
        'theme' => 'child-theme',
        'file' => 'course.php', 'regions' => array('side-pre'),
        'defaultregion' => 'side-pre',
        'options' => array('langmenu' => true),
    ),
    // Part of course, typical for modules - default page layout if $cm specified in require_login().
    'incourse' => array(
        'theme' => 'child-theme', 'file' => 'incourse.php',
        'regions' => array('side-pre'),
        'defaultregion' => 'side-pre',
    ),
];

Average of ratings: Useful (3)