You are here

protected function ContentTranslationTestBase::getEditUrl in Drupal 8

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

Returns the edit URL for the specified entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity being edited.

Return value

\Drupal\Core\Url The edit URL.

1 method overrides ContentTranslationTestBase::getEditUrl()
ContentTranslationPendingRevisionTestBase::getEditUrl in core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php
Returns the edit URL for the specified entity.

File

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

Class

ContentTranslationTestBase
Base class for content translation tests.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function getEditUrl(ContentEntityInterface $entity) {
  if ($entity
    ->access('update', $this->loggedInUser)) {
    $url = $entity
      ->toUrl('edit-form');
  }
  else {
    $url = $entity
      ->toUrl('drupal:content-translation-edit');
    $url
      ->setRouteParameter('language', $entity
      ->language()
      ->getId());
  }
  return $url;
}