Adding a fake block to a boost child theme Moodle 4.0

Adding a fake block to a boost child theme Moodle 4.0

yazan Tom Cripps -
Yanıt sayısı: 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 yanıt olarak

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

yazan Renaat Debleu -
Core developers 'ın resmi Particularly helpful Moodlers 'ın resmi Plugin developers 'ın resmi
Does your child theme implements a firstview_fakeblocks function in the core_renderer?
Renaat Debleu yanıt olarak

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

yazan Dominique Palumbo -
Particularly helpful Moodlers 'ın resmi Plugin developers 'ın resmi
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.
Renaat Debleu yanıt olarak

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

yazan 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!
Tom Cripps yanıt olarak

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

yazan Renaat Debleu -
Core developers 'ın resmi Particularly helpful Moodlers 'ın resmi Plugin developers 'ın resmi
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.