I need to wrap a custom number of blocks on a page to apply a grid system to them.
I know about setBlockWrapperStart()
and setBlockWrapperEnd()
, but these are applied after each block that is generated.
Let's say I have 12 Blocks of a given type and I want to wrap the first one at the beginning with <div class="row">
and after the 4th one I want to append </div>
. And with next (5th block) I want to start with <div class="row">
again...
Is there any way to implement that with concrete 5? I use the standard output right now and couldn't figure out how to add a loop or something to it to implement my approach:
$b = new Area('Test Block');
$b->display($c);
I'm using concrete 5.6.3.4. Thank you!
I ended up doing an override.
For this I copied the area.php
from concrete/models/
to models/area.php
and inserted the function display(&$c, $alternateBlockArray) {...}
from concrete/core/models/area.php
and adjusted it to my needs. With this I'm save for future CMS updates and can adjust the function without accidentally "destroying" the core functionality. :)
If you have any questions regarding this, feel free to ask me!