Closed (duplicate)
Project:
Fivestar
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2011 at 13:34 UTC
Updated:
27 Mar 2015 at 11:03 UTC
Jump to comment: Most recent
Comments
Comment #1
gbernier commentedHi silkAdmin,
I've been having a very frustrating battle tracking down everything to make this wrok as well. I thought I was going insane because no matter what I did the votes were not showing up even though I could see the ratings array was being populated.
I've been playing with the field settings this evening, but what happens it goes to the static HTML display showing the average vote and then you can vote on it, or if you are logged in you'll see just your vote. The one thing I found was setting the text in the settings array was still showing the proper votes, even though it wasn't be displayed in the stars when written as a form
Here's what I've got
$settings = array(
'content_type' => 'node',
'content_id' => $node->nid,
'stars' => 5,
'autosubmit' => TRUE,
'allow_clear' => FALSE,
'text' => 'smart', // options are none, average, smart, user, and dual
'tag' => 'vote',
'style' => 'dual', // options are average, dual, smart, user
'widget' => array('name' => 'default', 'css' => 'default'),
);
print render(drupal_get_form('fivestar_custom_widget', $node->field_resource_rating["und"][0], $settings));
The more detailed outline of the how the settings effect what themes are applied are in "fivestar_expand"
I've got alpha1 installed and I think it's a bug that it will not show the entity's average and still let you vote, as it seems to be one or the other.
If you figure it out let me know
Comment #2
ericduran commentedThis isn't needed. There's already an issue about this. This is a dupe.
Comment #3
ericduran commented#1203556: Anyone know how to print the widget on a tpl in D7?
Comment #4
EvaldsUrtans commentedIn order this to work on node and be able to submit values, you will need additional fields.
Drupal 7:
Comment #5
fruitiondenver commentedI don't think that is correct. Here's how I was able to programatically insert a fivestar widget anywhere in code:
Comment #6
wluisi commentedThanks for this, very helpful for my use case. You can also use a custom widget in a custom form. First define your widget in your module using hook_fivestar_widget. Then set the widget type in your form element.
Comment #7
nDigitHQ commentedI was able to reproduce this with taxonomy as well:
The $data['entity_id'] refers to the taxonomy term TID (or entity) value. Have yet to figure out how to get the label to work though. Digging through the code in fivestar_custom_widget.module to try to find this.