Average value not passed to static element display

Created on 17 July 2025, 6 months ago

Problem/Motivation

If the user is unable to place a vote, instead of seeing the average vote, the user sees the last vote placed.

Steps to reproduce

  1. Configure a vote type and add a fivestar field to an entity.
  2. Configure the field to be "Rated while viewing".
  3. Ensure the field is visible on both the entity form display and entity view display.
  4. Create an entity to use for our test.
  5. From the entity view display, submit a 5-star vote.
  6. As a new user or as a second vote for your current user, submit a 1-star vote.
  7. View the entity form display to view the average vote

Expectation: Result is a 3-star rating.

Reality: Result is a 1-star rating.

Proposed resolution

\Drupal\fivestar\Element\Fivestar should use the voting results manager to return votes in order to populate #values, otherwise these are always zero and the #default_value (current value of the field on the entity) is displayed.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States akalata

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024