Problem/Motivation
When opening the edit form of a node with a trashed paragraph the page fails with the following error:
Error: Call to a member function getTranslationLanguages() on null in Drupal\Core\Entity\ContentEntityStorageBase->createRevision() (line 402 of /[..]/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php).
#0 /[..]/web/modules/contrib/entity_reference_revisions/entity_reference_revisions.module(306): Drupal\Core\Entity\ContentEntityStorageBase->createRevision(Object(Drupal\minsky\Entity\Paragraph\Partner), false, false)
#1 /[..]/web/modules/contrib/hook_event_dispatcher/src/HookEventDispatcherModuleHandler.php(53): entity_reference_revisions_entity_revision_create(Object(Drupal\minsky\Entity\Paragraph\Partners), Object(Drupal\minsky\Entity\Paragraph\Partners), NULL)
When I purge all trashed paragraphs using drush tp paragraph the error disappears and the form loads as it should.
Issue fork trash-3592729
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
Comment #2
dieterholvoet commentedComment #3
amateescu commentedThis raises an interesting question, since paragraphs are composite entities owned by a host entity, should they be soft-deletable individually? My initial response would be "no", but I'm curious to hear more about your use case for having them as trashable.
Comment #4
dieterholvoet commentedNo, I guess it wouldn't be that useful to be able to soft-delete them individually. It would introduce more complexity for sure. They currently aren't soft-deletable through the UI, I'm doing it programatically in context of an automated content import. If we don't support soft-deleting paragraphs, we should probably hide them from the settings form at
/admin/config/content/trashthough, or at least disable and show a message.Comment #5
amateescu commentedRight, that's exactly what I think we should do as well. Let's use this issue to do that :)
Comment #7
amateescu commentedComment #8
dieterholvoet commentedI tested the MR. A status report message appears when trash is enabled for paragraphs and disappears once it's disabled. Maybe the paragraphs checkbox can be hidden or disabled on the settings form once it's been manually turned off? So users can't turn it back on again.
Comment #9
amateescu commentedThat's exactly what happens :)
Comment #10
dieterholvoet commentedIt seems like
$this->isTrashEnabled('paragraph')keeps returning TRUE after disabling. This happens because$field_definitions['deleted']->getProvider() === 'paragraphs'.Comment #11
amateescu commentedRight, I should've just checked the config instead.
Comment #14
amateescu commentedMerged into 3.1.x and cherry-picked to 3.x, thanks for reporting and testing!