print fivestar_widget_form($node); doesn't allow us to fully control of this beautiful module.it just render all needed fields for viewing results and voting.

for example , I would like to separate the "vote summary" and "vote selection" fields for non-java version , put them anywhere i want in my node.tpl.php and theme it freely. I even can't position the vote submit button unless using "position:absolute" css function.

i read everything before posting this issue and realized that most of article is out of date and doesn't work with the latest version of drupal and voting api.

Any suggestions ? :)

thnx

Comments

quicksketch’s picture

i read everything before posting this issue and realized that most of article is out of date and doesn't work with the latest version of drupal and voting api.

Which article are you referring to?

To print out the "static" display, you can use

  return theme('fivestar_static', $value, $stars, $tag);

To print out the "ratable" widget display:

    $votes = fivestar_get_votes($content_type, $content_id, $tag);
    $node_type = $node->type;

    $values = array(
      'user' => empty($votes['user']['value']) ? 0 : $votes['user']['value'],
      'average' => (int)$value,
      'count' => empty($votes['count']['value']) ? 0 : $votes['count']['value'],
    );
  
    $settings = array(
      'stars' => variable_get('fivestar_stars_'. $node_type, 5),
      'allow_clear' => variable_get('fivestar_unvote_'. $node_type, FALSE),
      // If the user has setup this content type to use smart stars, display
      // the smart version instead of just the average.
      'style' => variable_get('fivestar_style_'. $node_type, 'average') != 'smart' ? 'average' : 'smart',
      'text' => $summary ? variable_get('fivestar_text_'. $node_type, 'dual') : 'none',
      'content_type' => 'node',
      'content_id' => $node->nid,
      'tag' => $tag,
      'autosubmit' => TRUE,
      'title' => FALSE,
      'feedback_enable' => $summary ? variable_get('fivestar_feedback_'. $node_type, 1) : FALSE,
      'labels_enable' => $summary ? variable_get('fivestar_labels_enable_'. $node_type, 1) : FALSE,
      'labels' => $summary ? variable_get('fivestar_labels_'. $node_type, array()) : array(),
    );
  
    print drupal_get_form('fivestar_custom_widget', $values, $settings);

You can change any of the settings as necessary to create a completely customized widget, regardless of the node type settings.

quicksketch’s picture

Status: Active » Closed (fixed)

I'm marking closed after lack of response. The above answer should explain how to create a fully functional custom widget.

mauritskorse’s picture

I have a similar problem with saving votes. For some reason the votes of my multi axis widgets are added to the vote axis if available, otherwise it won't save anything.
I have tried adding the tag key to the $settings array, but it seems to me it is being ignored (I have quickly scanned through the source file but couldn't find any reference for the tag key in the fivestar_custom_widget function.

Is there maybe a patch I should have used?