function TermTranslationUITest::getEditValues

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php \Drupal\Tests\taxonomy\Functional\TermTranslationUITest::getEditValues()
  2. 8.9.x core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php \Drupal\Tests\taxonomy\Functional\TermTranslationUITest::getEditValues()
  3. 10 core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php \Drupal\Tests\taxonomy\Functional\TermTranslationUITest::getEditValues()

Returns an edit array containing the values to be posted.

Overrides ContentTranslationUITestBase::getEditValues

File

core/modules/taxonomy/tests/src/Functional/TermTranslationUITest.php, line 92

Class

TermTranslationUITest
Tests the Term Translation UI.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function getEditValues($values, $langcode, $new = FALSE) {
    $edit = parent::getEditValues($values, $langcode, $new);
    // To be able to post values for the configurable base fields (name,
    // description) have to be suffixed with [0][value].
    foreach ($edit as $property => $value) {
        foreach ([
            'name',
            'description',
        ] as $key) {
            if ($property == $key) {
                $edit[$key . '[0][value]'] = $value;
                unset($edit[$property]);
            }
        }
    }
    return $edit;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.