According to this change record and this issue, the getEntityTranslation method has been removed from the views module in Drupal 11. Yet one instance of the old method remains in src/Plugin/views/field/EntityFormField.php.

The deprecated code throws the following error when saving an entity in my web application:

Call to undefined method Drupal\views_entity_form_field\Plugin\views\field\EntityFormField::getEntityTranslation() in Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->saveEntities() (line 622 of /code/web/modules/contrib/views_entity_form_field/src/Plugin/views/field/EntityFormField.php).

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

daddison created an issue. See original summary.

daddison’s picture

Here's a patch that replaces getEntityTranslation method with getEntityTranslationByRelationship.

daddison’s picture

Title: Remove deprecated getEntityTranslation method » Replace deprecated getEntityTranslation method
anybody’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Assigned: daddison » Unassigned
Priority: Normal » Major
Status: Active » Needs work

Confirming this critical issue! This is entirely broken for D11 multilanguage projects currently. I'll try the patch!

anybody’s picture

anybody’s picture

Status: Needs work » Reviewed & tested by the community
Related issues: +#3582075: CI: fix phpcs & phpstan issues, +#3419794: Error when translatable entities are used

#3419794: Error when translatable entities are used seems outdated! The fix here works great, but is also contained in #3582075: CI: fix phpcs & phpstan issues so @daddison should be credited once that one is merged!

francoud’s picture

Received this error in Drupal 11.3.8 with the 1.0.0 version:

Error: Call to undefined method Drupal\views_entity_form_field\Plugin\views\field\EntityFormField::getEntityTranslation() in Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->saveEntities() (line 622 of [...]\web\modules\contrib\views_entity_form_field\src\Plugin\views\field\EntityFormField.php).

I hadn't this error with the 8.x-1.0-beta12 version. But this patch seems to solve the problem. Will we have a new stable version including this fix?

vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you everyone for your contributions.
Committed. 🍻
Will be available in version 1.1.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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