Problem/Motivation

Reference revisions cannot be viewed and an error is thrown.

Steps to reproduce

  • Create a Reference Revisions
  • View revisions
  • Click on the revision title
  • You will see the following error message
Error: Call to undefined method Drupal\Core\Entity\Controller\EntityViewController::viewRevision() in Drupal\bibcite_entity\Controller\ReferenceViewController->viewRevision() (line 65 of modules/custom/bibcite/modules/bibcite_entity/src/Controller/ReferenceViewController.php).
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 634)
Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
Fiber->start() (Line: 635)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

I assume we need to add a ReferenceRevisionViewController that extends EntityRevisionViewController.

Issue fork bibcite-3567740

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

zipymonkey created an issue. See original summary.

mark_fullmer’s picture

Title: Error when viewing a reference revision » [Drupal 11] Error when viewing a reference revision
Assigned: Unassigned » mark_fullmer

Just noting that this only occurs in Drupal 11. The speculation of what needs to be done makes sense generally, but it does raise the question of why this is not occurring when used on a site running Drupal 10...

mark_fullmer’s picture

Root cause: #3314346: EntityViewController::viewRevision is deprecated

EntityViewController::viewRevision() was deprecated in drupal:10.1.0 and removed from drupal:11.0.0. We should use \Drupal\Core\Entity\Controller\EntityRevisionViewController instead.

mark_fullmer’s picture

Assigned: mark_fullmer » Unassigned
Status: Active » Needs review

The MR proposes resolving this by starting to use the generic revision UI provided in Drupal core via #2350939: Implement a generic revision UI. Since this was introduced in Drupal 10.1, the core_version_requirement will need to be updated, and this should probably be part of a new minor version release (3.1.0).

mark_fullmer’s picture

Okay, the latest commits address the feedback on implementation, specifically:

- Permission to view revisions is now correctly associated with the entity **type** view permission per the Entity API. As an example for testing:

- [ ] A user with the "View Reference entities" and "Book: View revisions" permissions can view revisions for the Book Bibcite entity type
- [ ] A user with the same permissions cannot view revisions of other Bibcite entity types
- [ ] A user with the "View Reference entities" permission only cannot view revisions of any Bibcite entity type
- [ ] A user with the admin-level "Administer Reference entities" permission should be able to view revisions for all Bibcite entity types

- The active theme is now used to display the revisions (good catch!)

This is ready for another human review!

mark_fullmer’s picture

Status: Needs review » Fixed

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.