public static function WebformEntityAccess::checkResultsAccess in Webform 8.5
Same name and namespace in other branches
- 6.x 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.
- WebformOptionsLimitController::checkAccess in modules/
webform_options_limit/ src/ Controller/ WebformOptionsLimitController.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);
}