You are here

protected function ContentTranslationTestBase::getTranslatePermission in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/content_translation/src/Tests/ContentTranslationTestBase.php \Drupal\content_translation\Tests\ContentTranslationTestBase::getTranslatePermission()

Returns the translate permissions for the current entity and bundle.

2 calls to ContentTranslationTestBase::getTranslatePermission()
ContentTranslationTestBase::getTranslatorPermissions in core/modules/content_translation/src/Tests/ContentTranslationTestBase.php
Returns an array of permissions needed for the translator.
ContentTranslationWorkflowsTest::testWorkflows in core/modules/content_translation/src/Tests/ContentTranslationWorkflowsTest.php
Test simple and editorial translation workflows.

File

core/modules/content_translation/src/Tests/ContentTranslationTestBase.php, line 125
Contains \Drupal\content_translation\Tests\ContentTranslationTestBase.

Class

ContentTranslationTestBase
Base class for content translation tests.

Namespace

Drupal\content_translation\Tests

Code

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