Adding a fake block to a boost child theme Moodle 4.0

Adding a fake block to a boost child theme Moodle 4.0

door Tom Cripps -
Aantal antwoorden: 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!

Gemiddelde van de beoordelingen:  -
Als antwoord op Tom Cripps

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

door Dominique Palumbo -
Foto van Particularly helpful Moodlers Foto van Plugin developers
Hi,

I try the same and I see also nothing with no error. I'm still looking for what I missed.

Dominique.
Gemiddelde van de beoordelingen:  -
Als antwoord op Tom Cripps

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

door Renaat Debleu -
Foto van Core developers Foto van Particularly helpful Moodlers Foto van Plugin developers
Does your child theme implements a firstview_fakeblocks function in the core_renderer?
Gemiddelde van de beoordelingen:  -
Als antwoord op Renaat Debleu

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

door Dominique Palumbo -
Foto van Particularly helpful Moodlers Foto van 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.
Gemiddelde van de beoordelingen:  -
Als antwoord op Renaat Debleu

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

door 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!
Gemiddelde van de beoordelingen:  -
Als antwoord op Tom Cripps

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

door Renaat Debleu -
Foto van Core developers Foto van Particularly helpful Moodlers Foto van Plugin developers
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.
 
Gemiddelde van de beoordelingen:  -