function 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.
12 calls to AccessResult::allowedIf()
- BlockHasOverridesAccessCheck::access in core/
modules/ settings_tray/ src/ Access/ BlockHasOverridesAccessCheck.php - Checks access for accessing a block's 'settings_tray' form.
- BlockPluginHasSettingsTrayFormAccessCheck::accessBlockPlugin in core/
modules/ settings_tray/ src/ Access/ BlockPluginHasSettingsTrayFormAccessCheck.php - Checks access for accessing a block plugin's 'settings_tray' form.
- 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.
- ConfigTranslationFormAccess::doCheckAccess in core/
modules/ config_translation/ src/ Access/ ConfigTranslationFormAccess.php - Checks access given an account, configuration mapper, and source language.
File
-
core/
lib/ Drupal/ Core/ Access/ AccessResult.php, line 79
Class
- AccessResult
- Value object for passing an access result with cacheability metadata.
Namespace
Drupal\Core\AccessCode
public static function allowedIf($condition) {
return $condition ? static::allowed() : static::neutral();
}