AccessResult::allowedIf

public static AccessResult::allowedIf($condition)

Creates an allowed or neutral access result.

Parameters

bool $condition: The condition to evaluate.

Return value

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

File

core/lib/Drupal/Core/Access/AccessResult.php, line 76

Class

AccessResult
Value object for passing an access result with cacheability metadata.

Namespace

Drupal\Core\Access

Code

1
2
3
public static function allowedIf($condition) {
  return $condition ? static::allowed() : static::neutral();
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.