This module provides an accessible, 1-5 star rating widget with optional written feedback for any content. It follows the Digital Government Authority's Design System standards and displays dynamic statistics like average rating and review count. The widget works seamlessly for both anonymous and logged-in users and integrates into government-grade digital services.
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
.pofiles. - 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
hiddenattribute.
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
- 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.
- Open Content > Rating Dashboard to see submissions and statistics.
- 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.
Ask your assistant about DGA Rating
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.2.1 | Stable | 10–11 | PHP >=8.1 | Nov 12, 2026 | |
| 2.2.0 | Stable | 10–11 | PHP >=8.1 | Nov 12, 2026 | |
| 2.2.x-dev | Dev | 10–11 | PHP >=8.1 | Nov 12, 2026 | |
| 2.1.2 | Stable | 10–11 | May 21, 2026 | ||
| 2.1.1 | Stable | 10–11 | May 21, 2026 | ||
| 2.1.x-dev | Dev | 10–11 | Nov 13, 2025 | ||
| 2.1.0 | Stable | 10–11 | Nov 13, 2025 | ||
| 2.0.2 | Stable | 10–11 | Nov 6, 2025 | ||
| 2.0.x-dev | Dev | 10–11 | Nov 6, 2025 | ||
| 2.0.1 | Stable | 10–11 | Nov 5, 2025 |