Skip navigation
Help

theme_uc_usps_option_label

6 uc_usps.module theme_uc_usps_option_label($service, $packages)
7 uc_usps.theme.inc theme_uc_usps_option_label($variables)

Theme function to format the USPS service name and rate amount line-item shown to the customer.

Parameters

$variables: Associative array containing information needed to theme a quote. Contains two keys:

  • service: The USPS service name.
  • packages: Package information.

Related topics

1 theme call to theme_uc_usps_option_label()

File

ubercart/shipping/uc_usps/uc_usps.theme.inc, line 20
Theme functions for the uc_usps module.

Code

function theme_uc_usps_option_label($variables) {
  $service = $variables['service'];
  $packages = $variables['packages'];

  // Start with USPS logo.
  $output  = theme('image', array(
    'path' => drupal_get_path('module', 'uc_usps') . '/uc_usps_logo.gif', 
    'alt' => t('U.S.P.S.'), 
    'attributes' => array('class' => 'usps-logo'),
  ));

  // Add USPS service name, removing any 'U.S.P.S.' prefix.
  $output .= preg_replace('/^U\.S\.P\.S\./', '', $service);

  // Add package information
  $output .= ' (' . format_plural(count($packages), '1 package', '@count packages') . ')';

  return $output;
}