You are here

public static function WebformAccessResult::allowedIf in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Access/WebformAccessResult.php \Drupal\webform\Access\WebformAccessResult::allowedIf()

Creates an allowed or neutral access result.

Parameters

bool $condition: The condition to evaluate.

\Drupal\Core\Entity\EntityInterface|null $webform_entity: A webform or webform submission.

bool $cache_per_user: Cache per user.

Return value

\Drupal\Core\Access\AccessResult If $condition is TRUE, isAllowed() will be TRUE, otherwise isNeutral() will be TRUE.

2 calls to WebformAccessResult::allowedIf()
WebformAccessRulesManager::checkWebformAccess in src/WebformAccessRulesManager.php
Check if operation is allowed through access rules for a given webform.
WebformSubmissionAccessControlHandler::checkAccess in src/WebformSubmissionAccessControlHandler.php
Performs access checks.

File

src/Access/WebformAccessResult.php, line 28

Class

WebformAccessResult
Value object indicating an allowed access result, with cacheability metadata.

Namespace

Drupal\webform\Access

Code

public static function allowedIf($condition, EntityInterface $webform_entity = NULL, $cache_per_user = FALSE) {
  return $condition ? static::allowed($webform_entity, $cache_per_user) : static::neutral($webform_entity, $cache_per_user);
}