The Rate module also provides views integration via the VotingAPI module. In this video, I will show you how to add a rate widget to a view.

First, let's install and enable the views module.

Install modules

Enable modules

  • Go to "Modules" (admin/modules) and enable:
    • Chaos tools
    • Views
    • Views UI
  • (Save configuration)

Now, let's create a new view.

  • Go to "Structure => Views => Add new view" (admin/structure/views/add)
  • View name: Rating page
  • Show: Content
    • of type: Article
    • sorted by: Newest first
  • [x] Create a page
    • Display format: Choose "Table"
  • (Continue & Edit)

The first step is to add a relationship between the node its votes.

Advanced

  • Relationship
    • Click "Add"
    • [x] Content: Vote results
    • (Apply(all displays))
    • Value type: Choose "Options"
    • Vote tag: Choose "Helpfulness"
    • Aggregation function: Choose "Number of votes"
  • (Apply(all displays))

Next, let's add a field to show the rate widget.

Fields

  • Click "Add"
  • Vote results: Value
  • (Apply(all displays))
    • Label: How helpful is this article?
    • [ ] Place a colon after the label
    • Appearance: Choose "Rate Widget" (This shows the full widget)
  • (Apply(all displays))

Page Settings

  • Menu
  • Click "No menu"
    • [x] Normal menu entry
    • Title: Rating page
    • Menu: Main menu
    • Weight: 1
  • (Apply)
  • (Save) (Save the view)

Now we can click the "view Page" button to see the view. Now, this may not be the most practical example of implementing ratings in a view, but I hope it gets the point across so that you can use it where it makes sense in your projects.

In the next video, we're going to utilize the rating results for articles to sort and filter content in a view.