function overlay_block_access

Implements hook_block_access().

File

drupal/core/modules/overlay/overlay.module, line 397
Displays the Drupal administration interface in an overlay.

Code

function overlay_block_access(Block $block, $operation, AccountInterface $account, $langcode) {

  // If we are limiting rendering to a subset of page regions, hide all blocks
  // which appear in regions not on that list. Note that overlay_page_alter()
  // does a more comprehensive job of preventing unwanted regions from being
  // displayed (regardless of whether they contain blocks or not), but the
  // reason for duplicating effort here is performance; we do not even want
  // these blocks to be built if they are not going to be displayed.
  if ($regions_to_render = overlay_get_regions_to_render()) {
    if (!in_array($block
      ->get('region'), $regions_to_render)) {
      return FALSE;
    }
  }
}