Closed (fixed)
Project:
userreview
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2006 at 20:38 UTC
Updated:
22 Feb 2007 at 14:46 UTC
I have a situation where I want to control the number of decimals displayed on the vote value (truth be told, i had multiple entries with the same vote value and wanted to show more of a breakdown). Two small changes are needed to do this:
in function userreview_settings, add:
$form['userreview_vote_decimal'] = array(
'#type' => 'textfield',
'#default_value' => variable_get('userreview_vote_decimal','1'),
'#title' => 'Vote Decimal Places',
'#description' => t('Number of decimal places to include with the vote value.'),
);
in function theme_userreview_vote, support this:
/**
* Themes a userreview vote number. Places the caption below the numnber.
* Using table layout for most consistent cross-browser & cross-theme layout.
*/
function theme_userreview_vote($vote_value) {
$output = '';
if (is_numeric($vote_value)) {
$output .= '<table class="userreview_review_vote">';
$display_number = $vote_value;
if (floor($vote_value) < $vote_value) {
$display_number = number_format($vote_value, variable_get('userreview_vote_decimal','1') );
}
$output .= '<tr><td class="userreview_review_number">' . $display_number . '</td></tr>';
$caption = variable_get('userreview_vote_number_caption',t('out of 10'));
if ($caption) {
$output .= '<tr><td class="userreview_review_number_caption">' . $caption . '</td></tr>';
}
$output .= '</table>';
}
return $output;
}
Comments
Comment #1
jo1ene commentedComment #2
gerd riesselmann commentedIncluded in new release
Comment #3
(not verified) commented