- πΊπΈUnited States SocialNicheGuru
just noting that this patch conflicts with #3204583: Restrict create access to validated buyers β
- First commit to issue fork.
- πΊπΈUnited States rhovland Oregon
I started to redo this patch as a MR but then realized that the entire hook needed a rewrite.
I attempted to simplify the logic and make it compatible with layout builder.
Now it displays a placeholder when viewed in layout builder.Leaves the field display as is (empty) if the user is logged in and doesn't have permission to create reviews. Most users will see the empty text (including anon). The only users that won't see anything also can't do anything actionable. There's just random text, default being "write the first review" which would be nonsensical as just text with no link. The purpose of showing something (a link) is to invite a user to write a review.
Removed redundant check for existing user reviews. There are always no reviews for the product if this code runs.
Only directs anonymous users to login page, not everyone without create access.
This leaves one issue remaining here:
The hook does not run when layout builder is enabled for the product display. However if there is an overall rating then it will display that as expected within a layout.
Might be related to this issue? Haven't dug deep into this.
π Formatters for empty fields do not render with layout builder enabled Needs work - Merge request !22Rewrite entity_display_build_alter hook to simplify logic and make it... β (Merged) created by rhovland
- πΊπΈUnited States rhovland Oregon
Can confirm that the core issue is the cause of the empty text not showing up.
This MR fixes the problem
https://git.drupalcode.org/project/drupal/-/merge_requests/12052Everything works as it should now with layout builder.
Code needs a review. Code has been tested with various conditions on a fresh install and works as designed.
- πΊπΈUnited States rhovland Oregon
Adjusted logic to remove check for anon, since we can assume we want to ask users to login if they aren't authenticated.
Tested again.
Added Known Issue to README.md to explain how end users can use this module with layout builder. Can remove once fixed in Drupal Core.
-
rhovland β
committed 20dffae1 on 2.x
Issue #3310622 by rhovland, kaszarobert: Can't add Overall rating field...
-
rhovland β
committed 20dffae1 on 2.x
Automatically closed - issue fixed for 2 weeks with no activity.