function ConfigTranslationOverviewAccess::doCheckAccess
Same name in other branches
- 8.9.x core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php \Drupal\config_translation\Access\ConfigTranslationOverviewAccess::doCheckAccess()
- 10 core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php \Drupal\config_translation\Access\ConfigTranslationOverviewAccess::doCheckAccess()
- 11.x core/modules/config_translation/src/Access/ConfigTranslationOverviewAccess.php \Drupal\config_translation\Access\ConfigTranslationOverviewAccess::doCheckAccess()
Checks access given an account, configuration mapper, and source language.
Grants access if the proper permission is granted to the account, the configuration has translatable pieces, and the source language is not locked given it is present.
Parameters
\Drupal\Core\Session\AccountInterface $account: The account to check access for.
\Drupal\config_translation\ConfigMapperInterface $mapper: The configuration mapper to check access for.
\Drupal\Core\Language\LanguageInterface|null $source_language: The source language to check for, if any.
Return value
\Drupal\Core\Access\AccessResultInterface The result of the access check.
2 calls to ConfigTranslationOverviewAccess::doCheckAccess()
- ConfigTranslationFormAccess::doCheckAccess in core/
modules/ config_translation/ src/ Access/ ConfigTranslationFormAccess.php - Checks access given an account, configuration mapper, and source language.
- ConfigTranslationOverviewAccess::access in core/
modules/ config_translation/ src/ Access/ ConfigTranslationOverviewAccess.php - Checks access to the overview based on permissions and translatability.
1 method overrides ConfigTranslationOverviewAccess::doCheckAccess()
- ConfigTranslationFormAccess::doCheckAccess in core/
modules/ config_translation/ src/ Access/ ConfigTranslationFormAccess.php - Checks access given an account, configuration mapper, and source language.
File
-
core/
modules/ config_translation/ src/ Access/ ConfigTranslationOverviewAccess.php, line 106
Class
- ConfigTranslationOverviewAccess
- Checks access for displaying the configuration translation overview.
Namespace
Drupal\config_translation\AccessCode
protected function doCheckAccess(AccountInterface $account, ConfigMapperInterface $mapper, $source_language = NULL) {
$access = $account->hasPermission('translate configuration') && $mapper->hasSchema() && $mapper->hasTranslatable() && (!$source_language || !$source_language->isLocked());
return AccessResult::allowedIf($access)->cachePerPermissions();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.