Moodle 2.3 custom block regions fixed?

Moodle 2.3 custom block regions fixed?

by Miriam Laidlaw -
Number of replies: 6
Picture of Plugin developers

I just noticed that issue MDL-33890 to do with custom block regions in 2.3 has been resolved.

So I excitedly updated my local copy of Moodle 2.3 using GIT and switched to Aerie theme.

Excitement crushed. Despite having (I think?) all the correct divs and classes and ids, my blocks still behave exactly the same:

  • When editing is turned on, my side-post does a vanishing act after a few seconds (when the page finishes loading)
  • When I try and drag blocks from side-pre into one of my block regions (three along the top and three along the bottom) nothing happens. It's as if those regions don't exist.

Commenting out my custom block regions from the general.php file fixes the side-post disappearance, so there is still something I don't have right in the code... only I can't figure out what it is.

*sigh*

Perhaps someone else could look at it for me? I have been struggling with this for months.

My git repository for Aerie

Edit: Hmmm issue MDL-34496 is still open so perhaps it's not as fixed as I thought it was anyway.

Average of ratings: -
In reply to Miriam Laidlaw

Re: Moodle 2.3 custom block regions fixed?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Your blocks will work, if you add the correct syntax.

A custom block needs:

  1. div ID selector for the container holding the custom block needs to be the same name as the block, The div also needs CLASS selector 'block-region' also: eg: block-left = <div id="block-left" class=block-region">
  2. This then needs to follow the same code style for side-post and side-pre: eg:

    <?php if ($hasblockleft) { ?>
    <div id="block-left" class="block-region">
        <div class="region-content">
            <?php echo $OUTPUT->blocks_for_region('block-left') ?>
        </div>
    </div>
    <?php } ?>
  3. Not forgetting the $hasblockleft needs to be added to the top of the layout as normal.

The real downside to all this is that although the blocks will move the layout is all to pot. So if you want it to work in your theme, disable the dock.

Aardvark Postit as more problems with layout because the block.js code for is not right. Also you can only have blocks in the middle column in Course Pages and nowhere else!

Hope that explains it. Sorry, I had just assumed you had read those tracker discussion.

In reply to Mary Evans

Re: Moodle 2.3 custom block regions fixed?

by Miriam Laidlaw -
Picture of Plugin developers

Hmmm ok, so that doesn't actually work for my theme then. Disabling the dock just to have extra block regions is not a viable trade-off in my opinion. And having blocks in the middle column also doesn't work for Aerie, where the top and bottom blocks span across all three columns... argh.

Seriously.

angry Still not a happy camper.

(Mood also not helped by the fact that I can't even install Moodle 2.3 on my web server because it requires a higher version of mysql than I am given...)

*goes off to sulk* lol

In reply to Miriam Laidlaw

Re: Moodle 2.3 custom block regions fixed?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Can you not download WAMP server onto your PC?

I have 2.4 running on my Win 7 PC using WAMP 2 server...mind you it's only for themes.

In reply to Mary Evans

Re: Moodle 2.3 custom block regions fixed?

by Miriam Laidlaw -
Picture of Plugin developers

Oh, I have XAMPP running on my Mac and WAMP running on my PC and I can install whatever version of Moodle I want there. That's what I use for theme design.

I'm just upset that my online version of Moodle currently can't be upgraded beyond Moodle 2.2.

In reply to Miriam Laidlaw

Re: Moodle 2.3 custom block regions fixed?

by Derek Chirnside -

My Sympathies Miriam.  A little bit or red wine, caffiene, hot chocolate, extra trip to the gym or a movie maybe?  Nothing will change of course in your servers and code, but you may feel better.  

Themes are just a little too much for my brain at the moment.  I had an idea they were complex, but not how complex.

In reply to Derek Chirnside

Re: Moodle 2.3 custom block regions fixed?

by Miriam Laidlaw -
Picture of Plugin developers

Hi Derek. smile A night away from the computer certainly helped my mood lol. And themes don't always have to be as complicated as this. It's just when you're trying to do clever things like add extra block areas that thing become complicated!