function ConfigTranslationFormAccess::access
Same name in other branches
- 8.9.x core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php \Drupal\config_translation\Access\ConfigTranslationFormAccess::access()
- 10 core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php \Drupal\config_translation\Access\ConfigTranslationFormAccess::access()
- 11.x core/modules/config_translation/src/Access/ConfigTranslationFormAccess.php \Drupal\config_translation\Access\ConfigTranslationFormAccess::access()
Checks access to the overview based on permissions and translatability.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The route_match to check against.
\Drupal\Core\Session\AccountInterface $account: The account to check access for.
string $langcode: The language code of the target language.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
Overrides ConfigTranslationOverviewAccess::access
File
-
core/
modules/ config_translation/ src/ Access/ ConfigTranslationFormAccess.php, line 29
Class
- ConfigTranslationFormAccess
- Checks access for displaying the translation add, edit, and delete forms.
Namespace
Drupal\config_translation\AccessCode
public function access(RouteMatchInterface $route_match, AccountInterface $account, $langcode = NULL) {
$mapper = $this->getMapperFromRouteMatch($route_match);
try {
$source_langcode = $mapper->getLangcode();
$source_language = $this->languageManager
->getLanguage($source_langcode);
$target_language = $this->languageManager
->getLanguage($langcode);
return $this->doCheckAccess($account, $mapper, $source_language, $target_language);
} catch (ConfigMapperLanguageException $exception) {
return AccessResult::forbidden();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.