You are here

function block_content_permissions_block_content_create_access in Block Content Permissions 8

Implements hook_ENTITY_TYPE_create_access().

File

./block_content_permissions.module, line 57
Block content permissions module.

Code

function block_content_permissions_block_content_create_access(AccountInterface $account, array $context, $entity_bundle) {

  // Check 'create' permission for block content types.
  // Needed for inline form creation of block content (ex. Inline Entity Form).
  if ($account
    ->hasPermission("create {$entity_bundle} block content")) {
    return AccessResult::allowed();
  }
  else {
    return AccessResult::forbidden();
  }
}