Hi, I have one block that has a specific script, and that script should load only if that block is used.
$layouts = $page->layout()->toLayouts();
if ($layouts->hasBlockType('heading') === true) {
// include some scripts
}
Is doing its work good, but I use that block also on some pages out of the Layout field. Using it in the “simple” blocks field.
Is there maybe a way to check if page has some block type?