function ContentTranslationUITestBase::getEditValues

Same name and namespace in other branches
  1. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php \Drupal\Tests\content_translation\Functional\ContentTranslationUITestBase::getEditValues()

Returns an edit array containing the values to be posted.

File

core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php, line 407

Class

ContentTranslationUITestBase
Tests the Content Translation UI.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function getEditValues($values, $langcode, $new = FALSE) {
  $edit = $values[$langcode];
  $langcode = $new ? LanguageInterface::LANGCODE_NOT_SPECIFIED : $langcode;
  foreach ($values[$langcode] as $property => $value) {
    if (is_array($value)) {
      $edit["{$property}[0][value]"] = $value[0]['value'];
      unset($edit[$property]);
    }
  }
  return $edit;
}

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