Closed state: average rating, stars, review count and call to action.
Open state: star selection, comment box, information links and Submit. The Close button returns to the closed state.
Confirmation after submitting, showing the visitor's rating. The widget stays here and does not invite a repeat rating.
Arabic with a right-to-left layout: stars, text and button mirror correctly.
The open form on a 375 px wide phone screen.
Admin dashboard (Content > Rating Dashboard): statistics cards in the iDigit Gov style.
Translations form with one column per language (English, Arabic, French, Spanish, Chinese Simplified).

This project is not covered by Drupal’s security advisory policy.

DGA Rating adds an accessible 1–5 star rating to any page of your Drupal site. Visitors rate a service or page, add a short comment, and see the live average. Editors get a dashboard with statistics, filters, and bulk actions. The design follows the Saudi Digital Government Authority (DGA) Design System rating section.

What is new in 2.2

  • New design: the widget and the admin dashboard follow the iDigit Gov components. Styles are scoped to the module, use --dga-* design tokens with built-in fallbacks, and no longer load Bootstrap or an icon font.
  • Five languages: English, Arabic (right-to-left), French, Spanish and Chinese (Simplified), managed in one translation form — no .po files.
  • Submit row: a configurable comment placeholder, an information sentence and up to two links (for example a privacy statement).
  • No repeat ratings: a visitor's rating is remembered, so the widget stays on its confirmation.
  • Fixes for dashboard icon paths on Composer installs, the configured reviews label, and theme CSS overriding the hidden attribute.

Features

  • Star ratings from 1 to 5 with a comment; average rating and review count update after each submission.
  • Three states: closed (average, stars, count, call to action), open (form with inline validation), and submitted (confirmation).
  • Accessible by design: native keyboard operation, ARIA labels, visible focus, forced-colors and reduced-motion support.
  • Responsive layout, and a mirrored right-to-left layout for Arabic.
  • Ratings are stored per entity or per URL, for anonymous and authenticated visitors.
  • Admin dashboard: statistics cards, filters, a sortable submissions table, edit, delete, and bulk delete.
  • Configurable rate limiting (per IP for anonymous visitors, per account for logged-in users), a maximum comment length and an optional data retention period.
  • Three permissions: view the dashboard, manage submissions, administer settings.
  • No external dependencies.

Requirements

  • Drupal 10, 11 or 12 (^10 || ^11 || ^12) and PHP 8.1 or higher.
  • Verified on Drupal 11.4 and Drupal 12.0.0-beta2.

Installation

composer require drupal/dga_rating
drush en dga_rating
drush cr

When updating from an earlier release, run drush updb and drush cr. The update adds the new settings without overwriting values you configured.

Usage

  1. Go to Structure > Block layout and place the DGA Rating Widget block where it should appear. Use the block visibility settings to limit it to certain content types, paths, or roles.
  2. Open Content > Rating Dashboard to see submissions and statistics.
  3. Use Settings for texts, rate limiting and retention, and Translations for every language.

Theming

Override templates/dga-rating-widget.html.twig in your theme, or override the CSS custom properties (--dga-text-default, --dga-border-primary and the other --dga-* tokens) to match your brand. All widget styles are scoped to .rating-widget.

Security and privacy

  • Submissions are protected by a rate limit and comment text is sanitized before it is stored.
  • The visitor's IP address is stored for abuse prevention. Set a retention period in the settings to purge old submissions on cron.
  • Uninstalling the module drops the rating table and permanently deletes all ratings. Export first if you need the data.

Related

  • DGA Feedback — the companion Yes/No "Was this page useful?" widget.
  • iDigit Gov Feedback — the iDigit Gov distribution's own feedback and rating module.
Supporting organizations: 
funded the development and ongoing maintenance, released as a community contribution

Project information

Releases