You are here

protected function ContentTranslationTestBase::getTranslatePermission in Drupal 8

Same name in this branch
  1. 8 core/modules/content_translation/src/Tests/ContentTranslationTestBase.php \Drupal\content_translation\Tests\ContentTranslationTestBase::getTranslatePermission()
  2. 8 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.

1 call to ContentTranslationTestBase::getTranslatePermission()
ContentTranslationTestBase::getTranslatorPermissions in core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
Returns an array of permissions needed for the translator.

File

core/modules/content_translation/src/Tests/ContentTranslationTestBase.php, line 129

Class

ContentTranslationTestBase
Base class for content translation tests.

Namespace

Drupal\content_translation\Tests

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}";
  }
}