Hi,
I have some issues I hope you can help me with.
I followed each steps provided by Mary, but using Elegance theme, with a Elegantchild child theme (found in Moodle.org) I can't have a different custommenu on differet themes.
I followed these instructions too:
https://tracker.moodle.org/browse/MDL-31043
https://moodle.org/mod/forum/discuss.php?d=193738
Problems:
1) Elegantchild has its own settings.php.
If I add to it (where?) this lines afetr php opening tag nothing seems to happen, but of course it could depend on the fact that other steps are missing; if I put it inside the document (e.g. at line 56 or line 79) I get a blank page.
$name = 'theme_afterburner/custommenuitems';
$title = get_string('custommenuitems', 'admin');
$description = get_string('configcustommenuitems', 'admin');
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
$settings->add($setting);
So, I deleted old settings.php for child theme and created a new one with only this:
<?php
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Theme overrides custom menu
$name = 'theme_elegantchild/custommenuitems';
$title = get_string('custommenuitems', 'admin');
$description = get_string('configcustommenuitems', 'admin');
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
$settings->add($setting);
}
2) Assuming I have the settings.php above, I go forward and try with layout file. Elegantchild has no default.php file and no layout folder. If I create the folder and put a default.php in it (cloning from elegance theme, and changing
theme_elegance_initialise_reader($PAGE);
to
theme_elegantchild_initialise_reader($PAGE);
inside it (the only change I found), and then add
$custommenu = $OUTPUT->custom_menu($PAGE->theme->settings->custommenuitems);
$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
after the opening php tag, I get some strange message in the rendered page of the child theme, something like
[MAIN CONTENT GOES HERE - ZvJFRzKKnS]
and navigation buttons stop working. This is the only thing I can see from now.
One more thing, I tried also the MDL-31043 change (that is a little different, MAYBE, from Mary's), but Elegance default.php has no
$custommenu = $OUTPUT->custom_menu();
but a
<div id="moodle-navbar" class="navbar-collapse collapse">
<?php echo $OUTPUT->custom_menu(); ?>
<?php echo $OUTPUT->user_menu(); ?>
so I don't know how to change it to make it look like
$custommenu = $OUTPUT->custom_menu($PAGE->theme->settings->custommenuitems);
3) I tried to purge chaches, but after point 2) I can't browse site.
4) Mary wrote
Depending on where you want this menu to show you would need to add the file name to the $THEME->layouts found in the theme's config.php
Is this step I'm missing? I can't really figure out how to do this.
So, am I missing /doing wrong something? (I bet it's so!)
PS: I'm using Moodle 2.6.2. with Elegant / Elegantchild themes.