public static function WebformOptionsLimitAccess::checkNodeAccess in Webform 6.x
Check whether the user can access a node's webform options limits summary.
Parameters
string $operation: Operation being performed.
string $entity_access: Entity access rule that needs to be checked.
\Drupal\node\NodeInterface $node: A node.
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 string reference to 'WebformOptionsLimitAccess::checkNodeAccess'
- webform_options_limit.routing.yml in modules/
webform_options_limit/ webform_options_limit.routing.yml - modules/webform_options_limit/webform_options_limit.routing.yml
File
- modules/
webform_options_limit/ src/ Access/ WebformOptionsLimitAccess.php, line 50
Class
- WebformOptionsLimitAccess
- Defines the custom access control handler for the webform options limits.
Namespace
Drupal\webform_options_limit\AccessCode
public static function checkNodeAccess($operation, $entity_access, NodeInterface $node, AccountInterface $account) {
/** @var \Drupal\webform\WebformEntityReferenceManagerInterface $entity_reference_manager */
$entity_reference_manager = \Drupal::service('webform.entity_reference_manager');
$webform = $entity_reference_manager
->getWebform($node);
// Check that the node has a valid webform reference.
if (!$webform) {
return AccessResult::forbidden()
->addCacheableDependency($node);
}
if (!static::hasOptionsLimit($webform)) {
return AccessResult::forbidden()
->addCacheableDependency($webform);
}
return WebformNodeAccess::checkWebformResultsAccess($operation, $entity_access, $node, $account);
}