- Issue created by @rhovland
- Merge request !11Issue #3516551 by rhovland: Edit and delete my reviews functionality β (Merged) created by rhovland
- πΊπΈUnited States rhovland Oregon
Some notes about how the user facing entity list is handled:
The default entity list builder is designed for administrative use. It does not filter the list based on the current user.
The columns presented in the list are relevant for admin users but mostly useless for customers.
As a result it makes more sense to create a separate list builder for customers since the feature set is completely different.The user list is a route that points to the ProductReviewController to render a page.
The overviewPage() function that gets called to render a page uses the createHandlerInstance() feature of EntityTypeManagerInterface to set a custom handler, in this case a list builder. It then returns a rendered list built by the Entity system.The one dangling question comes from the comment on createHandlerInstance()
* Usually \Drupal\Core\Entity\EntityTypeManagerInterface::getHandler() is
* preferred since that method has additional checking that the class exists
* and has static caches.In this case the class always exists because it's part of the module so I'd think a check for that would be unnecessary.
That leaves the question of is this page being output cached? Or do we need to manually cache it? - πΊπΈUnited States rhovland Oregon
Here's a preview of how the customer's My Reviews page looks (in a bootstrap theme):
The action links for a user that has already left a review on a product's review page:
- Issue was unassigned.
- Status changed to Needs review
about 1 month ago 11:28pm 11 June 2025 - πΊπΈUnited States rhovland Oregon
I decided to revamp the default list builder and move the user page to use that list builder instead, greatly simplifying the code. The administrative page now uses a view by default which allows sorting, searching, filtering and further site builder customization for their workflow. It is installed with an update hook. The view can be disabled and it will fallback to using the default list builder.
Also access checking is now implemented correctly for the user review list and the list of reviews is based on the user id in the route instead of the current user so admins looking at a user's review list will see the correct list.
- πΊπΈUnited States rhovland Oregon
Tested the latest changes in a drupal-forge test site. Everything functioning correctly.
Here's the admin screen with the view disabled
Here's the admin screen view
I will review the code one more time tomorrow but I think this is probably good to commit.
-
rhovland β
committed a181ee97 on 2.x
Issue #3516551 by rhovland: Edit and delete my reviews functionality
-
rhovland β
committed a181ee97 on 2.x
Automatically closed - issue fixed for 2 weeks with no activity.