function theme_fivestar_formatter_default in Fivestar 7.2
Same name and namespace in other branches
- 8 includes/fivestar.theme.inc \theme_fivestar_formatter_default()
- 6.2 includes/fivestar.field.inc \theme_fivestar_formatter_default()
- 6 fivestar_field.inc \theme_fivestar_formatter_default()
Theme function for 'default' fivestar field formatter.
This themes static stars. That is, pairs of stars where neither set of stars is "exposed". Exposed stars are clickable and displayed in a form. Theming of exposed stars is handled by the form array (and calls the same theme functions called at the end of this function).
File
- includes/
fivestar.theme.inc, line 109 - Provides the theming functions for fivestar.
Code
function theme_fivestar_formatter_default($variables) {
$element = $variables['element'];
if (empty($element['#instance_settings']['stars'])) {
$element['#instance_settings']['stars'] = 5;
}
// Add CSS and JS.
$path = drupal_get_path('module', 'fivestar');
drupal_add_js($path . '/js/fivestar.js');
drupal_add_css($path . '/css/fivestar.css');
$variables = array(
'rating' => $element['#rating'],
'stars' => $element['#instance_settings']['stars'],
'widget' => $element['#widget'],
);
$star_display = theme('fivestar_static', $variables);
return theme('fivestar_static_element', array(
'description' => $element['#description'],
'star_display' => $star_display,
'is_form' => FALSE,
));
}