Loading core/modules/content_translation/src/ContentTranslationHandler.php +1 −1 Original line number Diff line number Diff line Loading @@ -487,7 +487,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En '#default_value' => User::load($uid), // Validation is done by static::entityFormValidate(). '#validate_reference' => FALSE, '#maxlength' => 60, '#maxlength' => 1024, '#description' => $this->t('Leave blank for %anonymous.', ['%anonymous' => \Drupal::config('user.settings')->get('anonymous')]), ]; Loading core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +13 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; use Drupal\user\UserInterface; /** * Tests the Content Translation UI. Loading Loading @@ -353,6 +354,18 @@ protected function doTestAuthoringInfo() { $metadata = $this->manager->getTranslationMetadata($entity->getTranslation($langcode)); $this->assertEquals($values[$langcode]['uid'], $metadata->getAuthor()->id(), 'Translation author correctly kept.'); $this->assertEquals($values[$langcode]['created'], $metadata->getCreatedTime(), 'Translation date correctly kept.'); // Verify that long usernames can be saved as the translation author. $user = $this->drupalCreateUser([], $this->randomMachineName(UserInterface::USERNAME_MAX_LENGTH)); $edit = [ // Format the username as it is entered in autocomplete fields. 'content_translation[uid]' => $user->getAccountName() . ' (' . $user->id() . ')', 'content_translation[created]' => $this->container->get('date.formatter')->format($values[$langcode]['created'], 'custom', 'Y-m-d H:i:s O'), ]; $this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode)); $reloaded_entity = $storage->load($this->entityId); $metadata = $this->manager->getTranslationMetadata($reloaded_entity->getTranslation($langcode)); $this->assertEquals($user->id(), $metadata->getAuthor()->id(), 'Translation author correctly set.'); } /** Loading Loading
core/modules/content_translation/src/ContentTranslationHandler.php +1 −1 Original line number Diff line number Diff line Loading @@ -487,7 +487,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En '#default_value' => User::load($uid), // Validation is done by static::entityFormValidate(). '#validate_reference' => FALSE, '#maxlength' => 60, '#maxlength' => 1024, '#description' => $this->t('Leave blank for %anonymous.', ['%anonymous' => \Drupal::config('user.settings')->get('anonymous')]), ]; Loading
core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +13 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; use Drupal\user\UserInterface; /** * Tests the Content Translation UI. Loading Loading @@ -353,6 +354,18 @@ protected function doTestAuthoringInfo() { $metadata = $this->manager->getTranslationMetadata($entity->getTranslation($langcode)); $this->assertEquals($values[$langcode]['uid'], $metadata->getAuthor()->id(), 'Translation author correctly kept.'); $this->assertEquals($values[$langcode]['created'], $metadata->getCreatedTime(), 'Translation date correctly kept.'); // Verify that long usernames can be saved as the translation author. $user = $this->drupalCreateUser([], $this->randomMachineName(UserInterface::USERNAME_MAX_LENGTH)); $edit = [ // Format the username as it is entered in autocomplete fields. 'content_translation[uid]' => $user->getAccountName() . ' (' . $user->id() . ')', 'content_translation[created]' => $this->container->get('date.formatter')->format($values[$langcode]['created'], 'custom', 'Y-m-d H:i:s O'), ]; $this->submitForm($edit, $this->getFormSubmitAction($entity, $langcode)); $reloaded_entity = $storage->load($this->entityId); $metadata = $this->manager->getTranslationMetadata($reloaded_entity->getTranslation($langcode)); $this->assertEquals($user->id(), $metadata->getAuthor()->id(), 'Translation author correctly set.'); } /** Loading