You are here

protected function ContentTranslationTestBase::getTranslatePermission in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationTestBase::getTranslatePermission()
  2. 9 core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationTestBase::getTranslatePermission()

Returns the translate permissions for the current entity and bundle.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationTestBase.php, line 123

Class

ContentTranslationTestBase
Base class for content translation tests.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function getTranslatePermission() {
  $entity_type = \Drupal::entityTypeManager()
    ->getDefinition($this->entityTypeId);
  if ($permission_granularity = $entity_type
    ->getPermissionGranularity()) {
    return $permission_granularity == 'bundle' ? "translate {$this->bundle} {$this->entityTypeId}" : "translate {$this->entityTypeId}";
  }
}