getTotalBlocksInArea($c) is not working on layouts. Is this a bug?

When an area contains only a layout with blocks within it, it is not finding this with the getTotalBlocksInArea($c) function. Is there another function I should be using to determine if there are layouts which are populated? Here is my code snippet...

<?php $a = new Area('Main');
if ($a->getTotalBlocksInArea($c) > 0 || $c->isEditMode()) { ?>
    <div class="centered">
        <div class="extra-block">
<?php } ?>

View Replies: View Best Answer
Mnkras replied on at Permalink Reply
thats because there are no blocks in the area, just a layout that has blocks,

im not sure if its a bug, but we should have a way of getting the area names in an area
olacom replied on at Permalink Reply
i'Ve just got that problem twice and I just figured out that it was due to this. I think this should be look into :-)
jordanlev replied on at Permalink Best Answer Reply
In case anyone comes across this in the future, I've posted a fix here: