You are here

protected function NodeTranslationUITest::getFormSubmitSuffix in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/node/src/Tests/NodeTranslationUITest.php \Drupal\node\Tests\NodeTranslationUITest::getFormSubmitSuffix()

Returns appropriate submit button suffix based on translatability.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity being tested.

string $langcode: Language code for the form.

Return value

string Submit button suffix based on translatability.

Overrides ContentTranslationUITestBase::getFormSubmitSuffix

2 calls to NodeTranslationUITest::getFormSubmitSuffix()
NodeTranslationUITest::doTestPublishedStatus in core/modules/node/src/Tests/NodeTranslationUITest.php
Tests the translation publishing status.
NodeTranslationUITest::getFormSubmitAction in core/modules/node/src/Tests/NodeTranslationUITest.php
Returns the form action value to be used to submit the entity form.

File

core/modules/node/src/Tests/NodeTranslationUITest.php, line 402
Contains \Drupal\node\Tests\NodeTranslationUITest.

Class

NodeTranslationUITest
Tests the Node Translation UI.

Namespace

Drupal\node\Tests

Code

protected function getFormSubmitSuffix(EntityInterface $entity, $langcode) {
  if (!$entity
    ->isNew() && $entity
    ->isTranslatable()) {
    $translations = $entity
      ->getTranslationLanguages();
    if ((count($translations) > 1 || !isset($translations[$langcode])) && ($field = $entity
      ->getFieldDefinition('status'))) {
      return ' ' . ($field
        ->isTranslatable() ? t('(this translation)') : t('(all translations)'));
    }
  }
  return '';
}