3

I have 2 custom blocks. I have added both this in regions of block layout. But when i disabled the block from layout. I must identify it from code or api that the particular block is disabled. How to know that?

0

1 Answer 1

4

Use BlockContent::getInstances to get all blocks placed for this custom block, then check for each block instance if it is enabled with $block->status().

See Get block programmatically and How can we check whether block is enabled or disabled in .theme file?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.