Get blocks in child pages area
Permalink
Hi,
I'm trying to get all the blocks in the Main area of child pages.
I've tried this:
But it's returning Call to undefined method Concrete\Core\Page\Page::getTotalBlocksInArea() (0)
Anyone know how to do this?
Thanks
Dave
I'm trying to get all the blocks in the Main area of child pages.
I've tried this:
foreach($pages as $page) { ... $inputArea = new Area("Main"); $blocks = $inputArea->getTotalBlocksInArea($page); ... }
But it's returning Call to undefined method Concrete\Core\Page\Page::getTotalBlocksInArea() (0)
Anyone know how to do this?
Thanks
Dave
What you have there looks right, but it's only going to give you a count of the blocks in the area, if you are trying to get an array of the actual blocks in an area you will need to do
Thanks, I have changed my code but I'm still seeing this in the logs:
Call to undefined method Concrete\Core\Area\Area::getTotalBlocksArray() (0)
Call to undefined method Concrete\Core\Area\Area::getTotalBlocksArray() (0)
You need the code to be getAreaBlocksArray
You're right, my bad.
Works great thank you very much :)
Works great thank you very much :)