2

I know that there are many rating or voting module like:

etc for drupal 7, I haven't found any modules for Drupal 8. How can I create a simple 5 star rating widget in Drupal 8?

Ideally I would like a solution, that doesn't require much coding, but can be achieved using existing modules and configuration.

  • What features do you need this field to have? – Jonathan Aug 3 '16 at 8:05
  • @Jonathan: I need Five Star features. – Mojtaba Reyhani Aug 3 '16 at 16:22
  • This is tagged as "too broad" but is more accurately "off topic" ("Questions asking to recommend or find a book, tool, module, theme, distribution, tutorial, or other off-site resource....") as it's asking for module recommendations. 2 of the projects mentioned are in progress of being ported to D8 so the answer is likely to change in the future. You can either help with the port (e.g. install the sandbox/dev version of the port and bug test), or "roll your own" while you wait for the maintainers to port it. – Shawn Conn Aug 5 '16 at 23:54
  • The first revision of the question was As I asked in above, how can I Add a "Rating Field" to a custom content type? and it was too broad. Now, as @ShawnConn said, it is off-topic because it is asking to recommend or find a module. We don't reopen a question just to closed for another reason. The question is still off-topic, for us. – kiamlaluno Aug 6 '16 at 5:25
  • 1
    There is something for Drupal 8 now: drupal.org/project/votingapi_widgets – Andre Baumeier Nov 28 '16 at 12:24
2

If you're willing to try a D8 module which has an alfa release, then the Votingapi Widgets module might help. Some details from its project page:

A flexible field based Voting System based on https://www.drupal.org/project/votingapi .

You need Drupal Version >= 8.2.3. (Multiple form instances on a page)

And a screenprint about it (also from its project page):

enter image description here

disclaimer: alfa status, and only a few installs ... use it at your own risk ...

| improve this answer | |
  • Why to use Voting API field and not integer field for storing? Does it have something more then just support for widgets? – Bobík Feb 9 '17 at 20:43
  • 1
    @Bobík for example from the voting API page: "Efficient caching of results (sorting and filtering doesn't require any recalculation) Hooks for additional vote calculations" – gagarine Feb 28 '18 at 1:06
4

Do it yourself version:

You also can add a custom field, integers, with min 1 and max 5 values. After this you only need to theme the display of the field, in a twig template maybe.

For achieving the star effect, there are plenty of solutions for that on google (css / js perspective).

One of them is to use field type List (integer) and in options use this values (so there will be select/radios with stars shown, but stored as a integer):

1|★
2|★★
3|★★★
4|★★★★
5|★★★★★
| improve this answer | |
  • Can someone provide more information on this one? sounds interesting to research. How to implement the js? – johnatasjmo Dec 6 '17 at 1:50
  • 1
    This is another question, and probably not Drupal related. – ssibal Dec 6 '17 at 7:27
2

The are several modules for this rating feature, but very few has the Drupal 8 version. You can use Voting API for D8. Do no know some other feature you need, may this work.

| improve this answer | |
1

For Drupal 8 you can use the Like Button module.

Add a Like button to Drupal content and comments!
Get instant statistics and insights! Sort content by likes!

Another useful module for Drupal 8 is the Vote Up/Down module.

Allows votes on some drupal entities and provides the base for implementing votes on other entities.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.