Using the block manager class

Re: Using the block manager class

by Mike Grant -
Number of replies: 0

Thank you very much for that, just in case anyone else is searching for the same thing, this is the code i'm using to detect if blocks are added to a page.

Thanks for your help Tim!

$block_manager = $PAGE->blocks;
$block_manager->load_blocks(true);
if($block_manager->is_block_present('block_name')) {
echo "Found";
} else {
echo "Not Found";
}