You are here

function uc_recurring_token_values in UC Recurring Payments and Subscriptions 6.2

Implementation of hook_token_values(). (token.module)

File

./uc_recurring.module, line 297
Allows you to add a recurring fee to a product/SKU to handle subscription type services.

Code

function uc_recurring_token_values($type, $object = NULL) {
  $values = array();
  switch ($type) {
    case 'recurring_fee':
      $fee = $object;
      $values['recurring-fee-id'] = $fee->rfid;
      $values['next-charge'] = format_date($fee->next_charge);
      $values['fee-amount'] = uc_store_format_price_field_value($fee->fee_amount);
      $values['fee-title'] = $fee->fee_title;
      $values['charged-intervals'] = $fee->charged_intervals;
      $values['remaining-intervals'] = $fee->remaining_intervals < 0 ? t('Until cancelled') : $fee->remaining_intervals;
      $values['renewal-attempts'] = $fee->attempts;
      $values['recurring-link'] = url('user/' . $fee->uid . '/recurring-fees', array(
        'absolute' => TRUE,
      ));
      break;
  }
  return $values;
}