I'm on Drupal 8,
I'm using \Drupal::entityQuery('block')
to get the list of blocks.
Now I want to determine if the block is visible for:
- Current Page (Content Type)
- Current User (Role)
- Current Path
I want this information according to visibility settings configured in block's configuration.
I can use $block->getVisibility()
method when I load the block and there I can iterate through visibility settings and find out if the block is visible or not.
I wander if there is a better and easier way to do this??