You are here

function fivestar_views_value_display_handler in Fivestar 5

Same name and namespace in other branches
  1. 6.2 fivestar.module \fivestar_views_value_display_handler()
  2. 6 fivestar.module \fivestar_views_value_display_handler()
1 call to fivestar_views_value_display_handler()
fivestar_views_widget_handler in ./fivestar.module

File

./fivestar.module, line 1590
A simple n-star voting widget, usable in other forms.

Code

function fivestar_views_value_display_handler($op, $filter, $value, &$query) {

  // Determine number of stars to display
  if (is_numeric($query->options)) {
    $stars = $query->options;
  }
  elseif (isset($query->node_type)) {
    $stars = variable_get('fivestar_stars_' . $query->node_type, 5);
  }
  else {
    $type = db_result(db_query("SELECT type FROM {node} WHERE nid = %d", $query->nid));
    $stars = variable_get('fivestar_stars_' . (!isset($type) ? 'default' : $type), 5);
  }

  // TODO: Find a reliable way of determining the tag.
  return theme('fivestar_static', $value, $stars, 'vote');
}