public function TestWebformHandler::access in Webform 8.5
Same name and namespace in other branches
- 6.x tests/modules/webform_test_handler/src/Plugin/WebformHandler/TestWebformHandler.php \Drupal\webform_test_handler\Plugin\WebformHandler\TestWebformHandler::access()
Controls entity operation access to webform submission.
Parameters
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
string $operation: The operation that is to be performed on $entity.
\Drupal\Core\Session\AccountInterface $account: The account trying to access the entity.
Return value
\Drupal\Core\Core\AccessResultInterface The result of the access check. No option returns a nuetral result.
Overrides WebformHandlerBase::access
File
- tests/
modules/ webform_test_handler/ src/ Plugin/ WebformHandler/ TestWebformHandler.php, line 164
Class
- TestWebformHandler
- Webform submission test handler.
Namespace
Drupal\webform_test_handler\Plugin\WebformHandlerCode
public function access(WebformSubmissionInterface $webform_submission, $operation, AccountInterface $account = NULL) {
$this
->displayMessage(__FUNCTION__ . 'Submission');
$value = $webform_submission
->getElementData('element');
if ($value === 'submission_access_denied') {
$access_result = AccessResult::forbidden();
}
else {
$access_result = parent::access($webform_submission, $operation, $account);
}
return $access_result
->setCacheMaxAge(0);
}