Review pages view

Created on 2 July 2025, 13 days ago

Problem/Motivation

The review page is based on an entity view with a provided template to change how individual reviews are laid out.
However the reviews page lacks a lot of layout options and customization possible with a configurable view (core Views module).

Proposed resolution

Create a default view for the review pages.

Remaining tasks

  • Create a view.
  • Make changes to the entity to allow using the "rendered entity" format option in the view so the template is respected.
  • Add sorting and filtering options.

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rhovland
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Encountered a problem when creating the view. The product review entity had a data_table definition, but the entity was not translatable.
    This was preventing the ability to choose the rendered entity option due to a mismatch in the table name being checked for in Views::fetchPluginNames().
    data_table should only be used on translatable entities.

    I'm guessing this was a side effect of the product entity code being copied to start development of this module.

    I removed the data_table definition from commerce_product_review entity and wrote an update hook to ensure existing data is migrated correctly. There should not be anything to migrate because the data field table was never created by the translation system. This update hook needs to be tested on an install with lots of reviews because I'm uncertain if it needs to be batched since no data is actually updated and it's really just the entity definition being updated (but the update system insists on running a data migration).

  • Merge request !19Review pages view β†’ (Merged) created by rhovland
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Here's a look at the view as installed in a new default Drupal 11 site. It's displaying the rendered entity, so any changes to the template file is reflected here on the individual reviews and field ordering and other stuff is still configured on the entity type display page.

  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Tested the update hook on a site with 10k reviews. Apparently using hook_update_N(&$sandbox) causes drupal to automatically batch the updates to avoid timeouts.

    With that question answered I think this is good to go. Just needs a code review.

  • Pipeline finished with Skipped
    4 days ago
    #545525
  • πŸ‡ΊπŸ‡ΈUnited States rhovland Oregon

    Code review done. Committed.

Production build 0.71.5 2024