Entity translation does not necessarily exist

Created on 3 March 2025, about 2 months ago

Coming from ๐Ÿ› InvalidArgumentException: Invalid translation language (en) specified Active - even though I'm not sure whether that commit triggered the fatal error, the code assumes that an entity has a translation for a langcode, which is not always the case.

To reproduce:
- have two languages, make sure the content type is translatable and the custom field too
- create a node in one language
- then go to the edit of this node in the other language (e.g. if source language is en, then go to es/node/x/edit
- you'll get following fatal crash: InvalidArgumentException: Invalid translation language (nl) specified, first line of backtrace leads to /home/drupal/modules/custom_field/src/Plugin/CustomFieldWidgetBase.php(116): Drupal\Core\Entity\ContentEntityBase->getTranslation()

patch upcoming

๐Ÿ› Bug report
Status

Active

Version

3.1

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium swentel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024