You are here

function webform_share_block_access in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_share/webform_share.module \webform_share_block_access()

Implements hook_block_access().

File

modules/webform_share/webform_share.module, line 141
Allows webforms to be shared on other websites using an iframe.

Code

function webform_share_block_access(Block $block, $operation, AccountInterface $account) {
  if (!WebformShareHelper::isPage()) {
    return AccessResult::neutral();
  }

  // Only adjust block view access.
  if ($operation !== 'view') {
    return AccessResult::neutral();
  }

  // Hide all blocks to improve the webform share page's performance.
  return AccessResult::forbidden();
}