public function UPSRateBase::getDisplayLabel in Ubercart 8.4
Returns the shipping quote method label with logo.
Parameters
string $label: The shipping quote method label to be styled.
Return value
array A render array containing the formatted shipping quote method label.
Overrides ShippingQuotePluginBase::getDisplayLabel
File
- shipping/
uc_ups/ src/ Plugin/ Ubercart/ ShippingQuote/ UPSRateBase.php, line 85
Class
- UPSRateBase
- Common functionality for UPS shipping quotes plugins.
Namespace
Drupal\uc_ups\Plugin\Ubercart\ShippingQuoteCode
public function getDisplayLabel($label) {
// Start with logo as required by the UPS terms of service.
$build['image'] = [
'#theme' => 'image',
'#uri' => drupal_get_path('module', 'uc_ups') . '/images/uc_ups_logo.jpg',
'#alt' => $this
->t('UPS logo'),
'#attributes' => [
'class' => [
'ups-logo',
],
],
];
// Add the UPS service name.
$build['label'] = [
'#plain_text' => $this
->t('@service Rate', [
'@service' => $label,
]),
];
// Add package information.
$build['packages'] = [
'#plain_text' => ' (' . \Drupal::translation()
->formatPlural(count($packages), '1 package', '@count packages') . ')',
];
return $build;
}