Themes

 
 
Wazza
Making theme able to have centre blocks
 

In many places on the moodle.org website I can read that centre blocks depend on your theme.

I miss the documentation. I build my own them based on Aardvark post-it. Now I want to be able to add blocks to the centre of a course.

If it's possible to do this in a courseformat I am happy to. I just need a block in the centre.

Can anyone point me in the right direction?

 
Average of ratings: -
Picture of Nathan Robbins
Re: Making theme able to have centre blocks
 

Hi Richard,

This is possible, and there are themes that provide this for Moodle 2.2 and earlier. Aerie and Obsidian come to mind, there may be others. They might work for 2.3+, but the drag-and-drop feature doesn't play nice with custom block regions yet... (I have a theme in the works where this might be fixed).

Thanks,

Nathan

 

 
Average of ratings: -
It's only an avatar...
Re: Making theme able to have centre blocks
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

Hi,

You can get blocks to work in Moodle 2.3+ if you write the code as specified below:

A custom block region MUST contain...

  1. $hassidecustom = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-custom', $OUTPUT)); //defined at the top of each layout file which contains the new block region.

You can then ADD your new custom block wherever you want it to be on the page providing you use the correct syntax as described below:

Please Note that the highlighted word 'custom' is a 'place holder' for the place to add your new block region name.

<?php if ($hassidecustom) { ?>
<div id="region-custom" class="block-region" >
<div class="region-content">
<?php echo $OUTPUT->blocks_for_region('side-custom') ?>
</div>
</div>
<?php } ?>

Whilst this will work with AJAX Drag-n-Drop enabled the pagelayout seem somewhat muddled if you dock blocks and your new block region is still on the page, it will assume the wrong layout. This is a known bug and will hopfull be address by the time Moodle 2.5 is released.

Just a reminder. You MUST include the word side and region as specified above.

Cheers

Mary

 
Average of ratings: -
Wazza
Re: Making theme able to have centre blocks
 

Thanks again Mary!

 
Average of ratings: -
It's only an avatar...
Re: Making theme able to have centre blocks
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Testers

If you need more help don't hesitate to ask.

Cheers

Mary

 
Average of ratings: -
Me
Re: Making theme able to have centre blocks
Group Moodle Course Creator Certificate holders

I need to rework Aerie to include this code so that it works. Ah, the to-do list grows again! big grin

 
Average of ratings: -