How do I code the traversal of all the layouts in an area.
Permalink
Hi,
I would like to programmatically traverse the contents of an area, creating a reference to each block in each layout of an area.
Consider expanding the trans_marine_save_area_to_pdf addon. [This post is not about this addon]
How do I have a block in a given area that can examine all of the blocks of all of the layouts in a given "main area"?
Currently the code segment below will instantiate $a as the Layout cell the block exists in.
I would like to programmatically traverse the contents of an area, creating a reference to each block in each layout of an area.
Consider expanding the trans_marine_save_area_to_pdf addon. [This post is not about this addon]
How do I have a block in a given area that can examine all of the blocks of all of the layouts in a given "main area"?
Currently the code segment below will instantiate $a as the Layout cell the block exists in.
if ( isset($_POST['cID'] )) { $a = new Area($_POST['areaHandle']); $c = Page::getByID($_POST['cID']); $blocks = $a->getAreaBlocksArray($c); foreach($blocks as $block) { if ( $block->getBlockTypeHandle() != 'save_area_to_pdf') { $p = new Permissions($block); if ( is_object($p) && $p->canRead() ) { $block->display(); } } }