Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294415

Deleting a translation causes error when logging the deletion message

$
0
0

Problem/Motivation

When deleting a translation of an entity I encounter an error

InvalidArgumentException: The entity object refers to a removed translation (fr) and cannot be manipulated. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 576 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Drupal\Core\Entity\ContentEntityBase->get('title') (Line: 1311)
Drupal\Core\Entity\ContentEntityBase->getEntityKey('label') (Line: 1262)
Drupal\Core\Entity\ContentEntityBase->label() (Line: 116)
Drupal\Core\Entity\ContentEntityDeleteForm->logDeletionMessage() (Line: 76)
Drupal\Core\Entity\ContentEntityDeleteForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)

This happens because in the logDeletionMessage() function we try to access the label of a deleted translation.

Steps to reproduce

Delete a translation for an entity (not the default translation).

Proposed resolution

We already have $message which is the value returned from getDeletionMessage(). We should just log this message, we already send it via the messenger service.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 294415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>