public function AccessControlHandler::blockContentAddFormAccess in Block Content Permissions 8
Access check for the block content add forms.
Return value
\Drupal\Core\Access\AccessResult An access result.
File
- src/
AccessControlHandler.php, line 128
Class
- AccessControlHandler
- Controller for the block content permissions.
Namespace
Drupal\block_content_permissionsCode
public function blockContentAddFormAccess(RouteMatchInterface $route_match) {
if ($block_content_type = $route_match
->getParameter('block_content_type')) {
$bundle_type = $block_content_type
->get('id');
$account = $this
->currentUser();
return AccessResult::allowedIfHasPermission($account, "create {$bundle_type} block content");
}
return AccessResult::neutral();
}