Skip to content
Snippets Groups Projects

Improve translation existence check in ContentEntityBase

Closed Nathan Lisgo requested to merge issue/drupal-3208030:3208030-a-translation-already-2 into 11.x
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -834,7 +834,7 @@ public function onChange($name) {
if ($this->isDefaultTranslation()) {
// Update the default internal language cache.
$this->setDefaultLangcode();
if (isset($this->translations[$this->defaultLangcode])) {
if (isset($this->translations[$this->defaultLangcode]['status'], $this->translations[$this->defaultLangcode]['entity'])) {
$message = new FormattableMarkup('A translation already exists for the specified language (@langcode).', ['@langcode' => $this->defaultLangcode]);
throw new \InvalidArgumentException($message);
}
Loading