type !== 'vision') { $vars['is_project'] = TRUE; } $votesUp = (int)db_query("SELECT * FROM {votingapi_vote} vv WHERE vv.entity_type = 'node' AND vv.entity_id = :nid AND vv.value = 100", [ ':nid' => $vars['content_id'], ])->rowCount(); $votesDown = (int)db_query("SELECT * FROM {votingapi_vote} vv WHERE vv.entity_type = 'node' AND vv.entity_id = :nid AND vv.value = 0", [ ':nid' => $vars['content_id'], ])->rowCount(); $vars['votes_total'] = (int)($votesUp + $votesDown); $vars['value'] = $vars['votes_total'] > 0 ? round(($votesUp / $vars['votes_total']) * 100, 0, PHP_ROUND_HALF_UP) : 0; $vars['chart_spacing'] = [ 'top' => 10, 'right' => 10, 'bottom' => 10, 'left' => 10, ]; $vars['widget_feedback_class'] = ''; if (isset($vars['results']['user_vote'])) { if ($vars['results']['user_vote'] == 0) { $vars['widget_feedback_class'] = 'rate-widget-vote-negative'; } else { $vars['widget_feedback_class'] = 'rate-widget-vote-positive'; } } $vr_button = '
'; $vars['buttons']['up'] = $vars['buttons']['down'] = $vr_button; $vars['buttons'] = []; if ($vars['mode'] == RATE_FULL) { $vars['chart_spacing'] = [ 'top' => 0, 'right' => 0, 'bottom' => 0, 'left' => 0, ]; foreach ($vars['links'] as $link) { $rate_button = theme('rate_button', ['text' => '!button', 'href' => $link['href'], 'class' => '']); $vars['buttons'][$link['text']] = str_replace('!button', $vr_button, str_replace('"!button"', '""', $rate_button)); } } }