You are here

function template_preprocess_pay_progress in Pay 6

Same name and namespace in other branches
  1. 7 modules/pay_progress/theme/pay_progress.theme.inc \template_preprocess_pay_progress()

A preprocess function for theme('pay_progress'). It generates the variables needed there.

The $variables array initially contains the following arguments:

  • $pfid: The Id of the payment form to check progress of.

See 'pay_progress.tpl.php' for their documentation.

File

modules/pay_progress/theme/pay_progress.theme.inc, line 42
Theme hooks and callbacks for the Payment Progress module.

Code

function template_preprocess_pay_progress(&$variables, $hook) {

  // Add base CSS for progress bar theming
  drupal_add_css(drupal_get_path('module', 'pay_progress') . '/theme/pay_progress.css');
  $pay_form = $variables['pay_form'];
  $variables['currency'] = $pay_form
    ->currency();
  $variables['goal'] = $goal = $pay_form
    ->total_goal();
  $variables['total'] = $total = $variables['progress_type'] == 'total' ? $pay_form
    ->total() : $pay_form
    ->total_paid();
  if ($goal) {
    $variables['percent'] = $goal > 0 ? $total / $goal * 100 : 0;
  }
}