Problem/Motivation
Adds UI blocks, dynamic rendering, and optional backend storage for managing anonymous and authenticated favourites.
Introduced a "My Favourites" block that dynamically displays selected content using JavaScript and AJAX.
Added a "Heart Icon" block for node pages, enabling users to toggle favourites via a visual and keyboard-accessible control.
- Implemented support for anonymous users using cookie-based storage, with a configurable expiration.
- Added a setting to toggle between cookie storage (for anonymous users) and database storage (per user uid for authenticated users).
- Created an AJAX controller that returns published node titles from stored favourites, with revision-safe querying.
- All frontend logic uses modern Drupal.behaviors and once() pattern, fully compatible with Drupal 10.4+ and 11.x.
- Code gracefully handles both revisionable and non-revisionable content types.
Comments
Comment #2
joseph.olstad