You are here

public function ContentTranslationDeleteAccess::access in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_translation/src/Access/ContentTranslationDeleteAccess.php \Drupal\content_translation\Access\ContentTranslationDeleteAccess::access()
  2. 9 core/modules/content_translation/src/Access/ContentTranslationDeleteAccess.php \Drupal\content_translation\Access\ContentTranslationDeleteAccess::access()

Checks access to translation deletion for the specified route match.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The parameterized route.

\Drupal\Core\Session\AccountInterface $account: The currently logged in account.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

File

core/modules/content_translation/src/Access/ContentTranslationDeleteAccess.php, line 65

Class

ContentTranslationDeleteAccess
Access check for entity translation deletion.

Namespace

Drupal\content_translation\Access

Code

public function access(RouteMatchInterface $route_match, AccountInterface $account) {
  $requirement = $route_match
    ->getRouteObject()
    ->getRequirement('_access_content_translation_delete');
  $entity_type_id = current(explode('.', $requirement));
  $entity = $route_match
    ->getParameter($entity_type_id);
  return $this
    ->checkAccess($entity);
}