You are here

public static function AccessResult::allowedIf in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Access/AccessResult.php \Drupal\Core\Access\AccessResult::allowedIf()

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.

8 calls to AccessResult::allowedIf()
AccessCheck::access in core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php
Check to see if user accessed this page.
AccessResultTest::providerTestAllowedIfHasPermissions in core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
Provides data for the testAllowedIfHasPermissions() method.
AccessResultTest::testAccessConditionallyAllowed in core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
@covers ::allowedIf @covers ::isAllowed @covers ::isForbidden @covers ::isNeutral
ChangedFieldItemList::defaultAccess in core/lib/Drupal/Core/Field/ChangedFieldItemList.php
Contains the default access logic of this field.
CommentController::replyFormAccess in core/modules/comment/src/Controller/CommentController.php
Access check for the reply form.

... See full list

File

core/lib/Drupal/Core/Access/AccessResult.php, line 75
Contains \Drupal\Core\Access\AccessResult.

Class

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

Namespace

Drupal\Core\Access

Code

public static function allowedIf($condition) {
  return $condition ? static::allowed() : static::neutral();
}