Hello,

I read that Rate has integration with views module and I read the procedure in the readme.txt
However I am not using fields in the views display. The Row style in my view is using the Display Suite Module and outputting a certain node build mode.

How can i see my rate widget in this case ?

Comments

weka’s picture

Project: Rate » Views displays
Version: 6.x-1.x-dev » 6.x-1.3
Component: Miscellaneous » Documentation

You probably get more responses from the Views displays module users.

swentel’s picture

Project: Views displays » Node displays contributions
Version: 6.x-1.3 » 6.x-2.x-dev
Status: Active » Fixed

You can create a new field at admin/ds/nd/fields and use following code:

$widget_id = 'the id of the rating widget here';
print rate_generate_widget($widget_id, 'node', $object->nid);

That will make the widget available as a field in the layout screen of DS.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

yeken’s picture

instead of $object object you should use $entity object (says below the code textarea)

$widget_id = '1'; // the id of the widget as shown in the url of the rate widget (in this case 1)
print rate_generate_widget($widget_id, 'node', $entity->nid);
pardalman’s picture

That works for node, but in my case: I want to show the widget for comments, how can I do it?
Thanks in advance!

Nikki Aiuto’s picture

I was able to get the widget working for comments by using the code in #4 but using the entity cid, not nid.

<?php
$widget_id = '1'; // the id of the widget as shown in the url of the rate widget (in this case 1)
print rate_generate_widget($widget_id, 'node', $entity->cid);
?>
grn’s picture

Comment #6

The 'node' should be changed to 'comment' I think.

<?php
$widget_id = '1'; // the id of the widget as shown in the url of the rate widget (in this case 1)
print rate_generate_widget($widget_id, 'node', $entity->cid);
?>

BR. GrN.dk

Sigvard’s picture

Finding the widget ID is very straightforward with Firebug if you can get the rate widget to display somewhere (my problem was that it showed up in comments but not in content).

But a very effective tactic is to just guess the nr as the first widget got the ID "1" and so on.

designarti’s picture

Issue summary: View changes

Worked with #4 in a code field, DS text format. DS version 7.x-2.6 - Drupal 7.30.
Thank you so much, yeken!

BartNijs’s picture

I've tried #4 but no luck.
Drupal 7.36, DS 7x-.28, Rate 7x-1.6

This is what I did:

  • added code field at /admin/structure/ds/fields
  • checked entities 'node'
  • in the Field code field I copied and pasted the code from #4
  • checked the widget id at /admin/structure/rate

When I add this field to the display of a node I get this error:
Notice: Undefined index: name in _field_ui_reduce_order() (line 81 of abc/modules/field_ui/field_ui.admin.inc)

UPDATE
I added the code to node.tpl.php and if I replace $entity with $node the code seems to work.
Still no luck in DS though.

UPDATE 2
The problem I had was a field group issue. Problem solved.