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

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

dieterholvoet created an issue. See original summary.

dieterholvoet’s picture

Issue summary: View changes
amateescu’s picture

Status: Active » Postponed (maintainer needs more info)

This 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.

dieterholvoet’s picture

No, 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/trash though, or at least disable and show a message.

amateescu’s picture

Title: Call to a member function getTranslationLanguages() on null » Mark paragraphs entities as unsupported
Status: Postponed (maintainer needs more info) » Active

Right, that's exactly what I think we should do as well. Let's use this issue to do that :)

amateescu’s picture

Status: Active » Needs review
dieterholvoet’s picture

I 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.

amateescu’s picture

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.

That's exactly what happens :)

dieterholvoet’s picture

Status: Needs review » Needs work

It seems like $this->isTrashEnabled('paragraph') keeps returning TRUE after disabling. This happens because $field_definitions['deleted']->getProvider() === 'paragraphs'.

amateescu’s picture

Status: Needs work » Needs review

Right, I should've just checked the config instead.

  • amateescu committed 69da4625 on 3.1.x
    fix: #3592729 Mark paragraphs entities as unsupported
    
    By: amateescu
    By...

  • amateescu committed 2d33b298 on 3.x
    fix: #3592729 Mark paragraphs entities as unsupported
    
    By: amateescu
    By...
amateescu’s picture

Status: Needs review » Fixed

Merged into 3.1.x and cherry-picked to 3.x, thanks for reporting and testing!

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.