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 tomonidan -
Number of replies: 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!

O'rtacha reytinglar: -
In reply to Tom Cripps

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

Renaat Debleu tomonidan -
Core developers rasmi Particularly helpful Moodlers rasmi Plugin developers rasmi
Does your child theme implements a firstview_fakeblocks function in the core_renderer?
In reply to Renaat Debleu

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

Dominique Palumbo tomonidan -
Particularly helpful Moodlers rasmi Plugin developers rasmi
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.
In reply to Renaat Debleu

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

Tom Cripps tomonidan -
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!
In reply to Tom Cripps

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

Renaat Debleu tomonidan -
Core developers rasmi Particularly helpful Moodlers rasmi Plugin developers rasmi
I had issues with some themes until I implemented this code to the theme renderer and started debugging. Standard only the site-pre region is checked.