template_preprocess_poll_bar

Versions
6 – 7
template_preprocess_poll_bar(&$variables)

Preprocess the poll_bar theme hook.

Inputs: $title, $votes, $total_votes, $voted, $block

See also

poll-bar.tpl.php

@see poll-bar-block.tpl.php

See also

theme_poll_bar()

Code

modules/poll/poll.module, line 834

<?php
function template_preprocess_poll_bar(&$variables) {
  if ($variables['block']) {
    $variables['template_files'][] = 'poll-bar-block';
  }
  $variables['title'] = check_plain($variables['title']);
  $variables['percentage'] = round($variables['votes'] * 100 / max($variables['total_votes'], 1));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.