AccessResult::forbidden

public static AccessResult::forbidden($reason = NULL)

Creates an AccessResultInterface object with isForbidden() === TRUE.

Parameters

string|null $reason: (optional) The reason why access is forbidden. Intended for developers, hence not translatable.

Return value

\Drupal\Core\Access\AccessResult isForbidden() will be TRUE.

File

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

Class

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

Namespace

Drupal\Core\Access

Code

public static function forbidden($reason = NULL) {
  assert('is_string($reason) || is_null($reason)');
  return new AccessResultForbidden($reason);
}
doc_Drupal
2016-10-29 08:42:30
Comments
Leave a Comment

Please login to continue.