public static function WebformEntityAccess::checkResultsAccess in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Access/WebformEntityAccess.php \Drupal\webform\Access\WebformEntityAccess::checkResultsAccess()
Check whether the webform has results.
Parameters
\Drupal\webform\WebformInterface $webform: A webform.
\Drupal\Core\Entity\EntityInterface|null $source_entity: The source entity.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
3 calls to WebformEntityAccess::checkResultsAccess()
- WebformEntityAccess::checkLogAccess in src/
Access/ WebformEntityAccess.php - Check whether the webform has log.
- WebformNodeAccess::checkWebformResultsAccess in modules/
webform_node/ src/ Access/ WebformNodeAccess.php - Check whether the user can access a node's webform results.
- WebformOptionsLimitAccess::checkAccess in modules/
webform_options_limit/ src/ Access/ WebformOptionsLimitAccess.php - Check whether the webform option limits summary.
File
- src/
Access/ WebformEntityAccess.php, line 55
Class
- WebformEntityAccess
- Defines the custom access control handler for the webform entities.
Namespace
Drupal\webform\AccessCode
public static function checkResultsAccess(WebformInterface $webform, EntityInterface $source_entity = NULL) {
// If results are not disabled return neutral.
if (!$webform
->getSetting('results_disabled')) {
$access_result = AccessResult::allowed();
}
elseif (\Drupal::entityTypeManager()
->getStorage('webform_submission')
->getTotal($webform, $source_entity)) {
$access_result = AccessResult::allowed();
}
else {
$access_result = AccessResult::forbidden();
}
return $access_result
->addCacheableDependency($webform);
}