function theme_uc_usps_option_label in Ubercart 8.4
Same name and namespace in other branches
- 6.2 shipping/uc_usps/uc_usps.module \theme_uc_usps_option_label()
- 7.3 shipping/uc_usps/uc_usps.theme.inc \theme_uc_usps_option_label()
Theming of the customer-facing USPS service name and rate amount line-item.
Parameters
array $variables: Associative array containing information needed to theme a quote. Contains two keys:
- service: The USPS service name.
- packages: Package information.
Return value
string Formatted HTML.
1 string reference to 'theme_uc_usps_option_label'
- uc_usps_theme in shipping/
uc_usps/ uc_usps.module - Implements hook_theme().
File
- shipping/
uc_usps/ uc_usps.theme.inc, line 22 - Theme functions for the uc_usps module.
Code
function theme_uc_usps_option_label(array $variables) {
$service = $variables['service'];
$packages = $variables['packages'];
$build['image'] = [
'#theme' => 'image',
'#uri' => drupal_get_path('module', 'uc_usps') . '/images/uc_usps_logo.jpg',
'#alt' => t('U.S.P.S.'),
'#attributes' => [
'class' => [
'usps-logo',
],
],
];
// Add USPS service name, removing any 'U.S.P.S.' prefix.
$build['label'] = [
'#plain_text' => preg_replace('/^U\\.S\\.P\\.S\\./', '', $service),
];
// Add package information.
$build['packages'] = [
'#plain_text' => ' (' . \Drupal::translation()
->formatPlural(count($packages), '1 package', '@count packages') . ')',
];
return drupal_render($build);
}