function AccessResult::allowedIf
Same name in other branches
- 9 core/lib/Drupal/Core/Access/AccessResult.php \Drupal\Core\Access\AccessResult::allowedIf()
- 8.9.x core/lib/Drupal/Core/Access/AccessResult.php \Drupal\Core\Access\AccessResult::allowedIf()
- 11.x 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.
20 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
- 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.
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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.