You are here

function theme_choices_choices in Poll Improved 7

1 theme call to theme_choices_choices()
choices_field_formatter_view in modules/choices/choices.module
Implements hook_field_formatter_view().

File

modules/choices/theme/choices.theme.inc, line 3

Code

function theme_choices_choices($variables) {
  $items = $variables['element']['#choice_items'];
  $total_vote_count = '';
  if (isset($variables['element']['#total_count'])) {
    $total_vote_count = format_plural($variables['element']['#total_count'], 'Total of 1 vote', 'Total of @count votes');
  }
  $output = array();
  foreach ($items as $delta => $item) {
    $bar = '';
    if (isset($item['#percentage'])) {
      $percentage = round($item['#percentage']);
      $bar = "<div class='choice-percentage-bar' style='width: {$percentage}%'></div>";
    }
    $output[] = "<div class='choice-item'><div class='choice-data clearfix'>{$item['#markup']}{$bar}</div></div>";
  }
  $output[] = "<div class='choices-total-vote-count'>{$total_vote_count}</div>";
  return join('', $output);
}