You are here

public function AccessControlHandler::blockFormAccess in Block Region Permissions 8

Access check for the block edit and delete forms.

Parameters

\Drupal\block\Entity\Block $block: The block.

Return value

\Drupal\Core\Access\AccessResultInterface An access result.

File

src/AccessControlHandler.php, line 68

Class

AccessControlHandler
Controller for the block region permissions.

Namespace

Drupal\block_region_permissions

Code

public function blockFormAccess(Block $block) {
  $account = $this
    ->currentUser();
  $theme = $block
    ->get('theme');
  $region = $block
    ->get('region');

  // Check if the user has the proper permissions.
  $access = AccessResult::allowedIfHasPermission($account, "administer {$theme} {$region}");
  return $access;
}