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

public static function allowedIf($condition) {
  return $condition ? static::allowed() : static::neutral();
}
doc_Drupal
2016-10-29 08:42:29
Comments
Leave a Comment

Please login to continue.