function rate_preprocess_rate_template_thumbs_up_down in Rate 6.2
Same name and namespace in other branches
- 7 rate.module \rate_preprocess_rate_template_thumbs_up_down()
Preprocess function for the thumbs_up_down template.
File
- ./
rate.module, line 1067 - Rate module
Code
function rate_preprocess_rate_template_thumbs_up_down(&$variables) {
extract($variables);
$up_classes = 'rate-thumbs-up-down-btn-up';
$down_classes = 'rate-thumbs-up-down-btn-down';
if (isset($results['user_vote'])) {
switch ($results['user_vote']) {
case $links[0]['value']:
$up_classes .= ' rate-voted';
break;
case $links[1]['value']:
$down_classes .= ' rate-voted';
break;
}
}
$variables['up_button'] = theme('rate_button', $links[0]['text'], $links[0]['href'], $up_classes);
$variables['down_button'] = theme('rate_button', $links[1]['text'], $links[1]['href'], $down_classes);
$info = array();
if ($mode == RATE_CLOSED) {
$info[] = t('Voting is closed.');
}
if ($mode != RATE_COMPACT && $mode != RATE_COMPACT_DISABLED) {
if (isset($results['user_vote'])) {
$info[] = t('You voted \'@option\'.', array(
'@option' => $results['user_vote'] == 1 ? $links[0]['text'] : $links[1]['text'],
));
}
}
$variables['info'] = implode(' ', $info);
}