Adding a fake block to a boost child theme Moodle 4.0

Adding a fake block to a boost child theme Moodle 4.0

дэргэд Tom Cripps -
Хариу нийтлэлийн тоо: 6

Hi lovely people, I'm wondering if I can get a bit of advice. I'm something of a novice at theming, but I often find some of the instruction examples in the Moodle docs to be helpful but also assume more knowledge than I currently have! I'd like to add a fake block to my Moodle 4.0 Boost child theme, and I'm trying to understand what to add to my theme's lib.php based off the instruction found here.

Adding the code as is, produces an error, and if I make it a fully formed function like so:

theme_fakeblock_get_html_for_settings(renderer_base $output, moodle_page $page) {

$bc = new block_contents();
$bc->title = 'fake title';
$bc->attributes['class'] = 'fakeblock';
$bc->content = 'fake content';
$page->blocks->add_fake_block($bc, 'side-pre');

}

– then add that to my theme's lib file then it produces no errors but doesn't add a fake block. I'm presumably missing something very obvious, but I can't work it out. Thanks for any assistance, I'm hoping it's something really simple!

Үнэлгээний дундаж: -
Tom Cripps-н хариуд

Re: Adding a fake block to a boost child theme Moodle 4.0

дэргэд Renaat Debleu -
Core developers зураг Particularly helpful Moodlers зураг Plugin developers зураг
Does your child theme implements a firstview_fakeblocks function in the core_renderer?
Renaat Debleu-н хариуд

Re: Adding a fake block to a boost child theme Moodle 4.0

дэргэд Dominique Palumbo -
Particularly helpful Moodlers зураг Plugin developers зураг
Hi,

in my case no. I don't implemented it.

I also get an error when I reset the theme cache.

Notice: Undefined property: theme_config::$haseditswitch in MoodleWindowsInstaller-latest-400\server\moodle\lib\adminlib.php on line 8868
(the line if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch)  {)

Thank you.

Dominique.
Dominique Palumbo-н хариуд

Re: Adding a fake block to a boost child theme Moodle 4.0

дэргэд Tristan Chevrier -
Hi,
You should add a line in your config.php child theme : https://docs.moodle.org/dev/Moodle_4.0_developer_update#Theme_changes
Same error disappear on my moodle when i add the line.
Tristan.
Renaat Debleu-н хариуд

Re: Adding a fake block to a boost child theme Moodle 4.0

дэргэд Tom Cripps -
Hi Renaat,

I have not implemented that no, would you be able to let me know what to add to the core_renderer?

Apologies for the late response I've been away on holiday!