Fatal error:  Cannot use object of type Drupal\field\Entity\FieldInstance as array in /Users/drupal/drupal/core/modules/content_translation/content_translation.module on line 1000

When editing a field

Fatal error: Call to a member function isFieldTranslatable() on a non-object in /Users/drupal/drupal/core/modules/content_translation/content_translation.module on line 813

Because of #1953408: Remove ArrayAccess BC layer from field config entities

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel’s picture

Status: Active » Needs review
FileSize
715 bytes
johnennew’s picture

Status: Needs review » Reviewed & tested by the community

I've seen this issue to and came up with the same fix. I confirm that this fixes the issue

plach’s picture

Looks good to me but I am afraid we need some basic test coverage.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Indeed.

swentel’s picture

Pfew, there's more things going wrong with the content translation module, editing an individual field also fatals:

Fatal error: Call to a member function isFieldTranslatable() on a non-object in /Users/drupal/drupal/core/modules/content_translation/content_translation.module on line 813
swentel’s picture

Assigned: Unassigned » swentel

Working on it

swentel’s picture

Status: Needs work » Needs review
FileSize
3.87 KB
2.45 KB

Ok, I have a test for the breakage on the field edit form.

I don't have one yet for the batch on admin/config/regional/content-language. When on standard and submitting that page, it always disables translatability of the user picture for some reason and I haven't been able to figure out what's going on there, or even why it's disabling that all the time, even if all checkboxes for user etc are disabled. To me, this sounds like a different bug which we might need to explore somewhere else ?

plach’s picture

@swentel:

I think we can skip the batch on admin/config/regional/content-language, I am about to remove that as part of #2076445: Make sure language codes for original field values always match entity language regardless of field translatability.

The issue you are talking about might be #1894596: Account settings cannot be saved anymore if content translation module is installed.

plach’s picture

FileSize
5.13 KB
2.47 KB

Awesome!

I reviewed and tested the patch and overall it looks good. We were missing test coverage for the exception reported in the OP. Added that. Maybe @ceng can perform a last test/review and RTBC this?

johnennew’s picture

Doing this now

johnennew’s picture

Status: Needs review » Reviewed & tested by the community

This patch looks good to me.

Confirmed current 8.x HEAD has the OP error when trying to set content translation settings on admin/config/regional/content-language.

Applied this patch cleanly and the error no longer occurs.

Patch looks good and test coverage appears good as well. Setting to RTBC.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.