Coming from #3508870: InvalidArgumentException: Invalid translation language (en) specified - 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, and you have Dutch, go to nl/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

CommentFileSizeAuthor
#2 3510744-2.patch950 bytesswentel
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

swentel created an issue. See original summary.

swentel’s picture

Status: Active » Needs review
StatusFileSize
new950 bytes
swentel’s picture

Issue summary: View changes
swentel’s picture

Issue summary: View changes
swentel’s picture

Issue summary: View changes

keshav patel made their first commit to this issue’s fork.

keshav patel’s picture

Created an MR using #2 patch, needs review.

andreasderijcke made their first commit to this issue’s fork.

andreasderijcke’s picture

Status: Needs review » Reviewed & tested by the community

I cannot reproduce the case, but the additional check makes sense and should not break anything, in contrary.

apmsooner made their first commit to this issue’s fork.

apmsooner’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch and reviews!

swentel’s picture

Thanks for all the maintenance love too! :)

I'm amazed the module usage is still so low, because it really is wonderful, so thank you for all the fantastic work!

apmsooner’s picture

Thanks for the encouragement! I've tried to promote the module in slack and various other places to increase usage but I guess alot of devs like to do things their own way or just don't understand the value proposition.

apmsooner’s picture

Status: Fixed » Closed (fixed)