You are here

public static function AccessResult::forbiddenIf 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::forbiddenIf()

Creates a forbidden or neutral access result.

Parameters

bool $condition: The condition to evaluate.

Return value

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

2 calls to AccessResult::forbiddenIf()
AccessResultTest::testAccessConditionallyForbidden in core/tests/Drupal/Tests/Core/Access/AccessResultTest.php
@covers ::forbiddenIf @covers ::isAllowed @covers ::isForbidden @covers ::isNeutral
language_entity_field_access in core/modules/language/language.module
Implements hook_entity_field_access()

File

core/lib/Drupal/Core/Access/AccessResult.php, line 89
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 forbiddenIf($condition) {
  return $condition ? static::forbidden() : static::neutral();
}