Return to Snippet

Revision: 16024
at July 23, 2009 11:02 by humanoid


Initial Code
<?php
    $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);
?>

Initial URL
http://drupal.org/node/313968

Initial Description
Drupal FiveStar change any of the settings as necessary to create a completely customized widget, regardless of the node type settings.

Initial Title
Drupal FiveStar custom widget

Initial Tags
drupal

Initial Language
PHP