Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the entity revision revert and delete buttons on the revisions tab #4295

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ollie222
Copy link

Problem/Motivation

When creating an entity using Drupal 8.9.13 and Console 1.9.7 and the command generate:entity:content the revert and delete links on the entity's revisions tab fail with an error

Error: Call to a member function loadRevision() on null in Drupal\my_module\Form\ExampleRevisionRevertForm->buildForm() (line 90 of /web/public/modules/custom/my_module/src/Form/ExampleRevisionRevertForm.php)

and

Error: Call to a member function loadRevision() on null in Drupal\my_module\Form\ExampleRevisionDeleteForm->buildForm() (line 90 of /web/public/modules/custom/my_module/src/Form/ExampleRevisionDeleteForm.php)

These two errors are caused by $this->{{ entity_class }}Storage->loadRevision as the entity class has a capital letter at the start whereas other references to it use a lower case first letter.

There is a further error on the delete confirmation page when the created entity is not translatable.

This is caused by a hard coded reference to the {'entity_name'_field_revision} table which doesn't exist for entities that aren't translatable.

How to reproduce

Using Drupal 8.9.13 and Console 1.9.7 create an entity using 'generate:entity:content'.
Add a piece of content and save
Revise the piece of entity and save
Click the Revisions tab and try and revert or delete the old revision.

Solution

This patch alters the relevant templates and should fix all of these problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant