You are here

public function USPSRateBase::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

3 calls to USPSRateBase::getDisplayLabel()
USPSDomesticRate::quote in shipping/uc_usps/src/Plugin/Ubercart/ShippingQuote/USPSDomesticRate.php
Callback for retrieving USPS shipping quote.
USPSInternationalRate::quote in shipping/uc_usps/src/Plugin/Ubercart/ShippingQuote/USPSInternationalRate.php
Callback for retrieving USPS shipping quote.
USPSRateBase::quote in shipping/uc_usps/src/Plugin/Ubercart/ShippingQuote/USPSRateBase.php
Callback for retrieving USPS shipping quote.

File

shipping/uc_usps/src/Plugin/Ubercart/ShippingQuote/USPSRateBase.php, line 85

Class

USPSRateBase
Common functionality for USPS shipping quotes plugins.

Namespace

Drupal\uc_usps\Plugin\Ubercart\ShippingQuote

Code

public function getDisplayLabel($label) {

  // USPS logo.
  $build['image'] = [
    '#theme' => 'image',
    '#uri' => drupal_get_path('module', 'uc_usps') . '/images/uc_usps_logo.jpg',
    '#alt' => $this
      ->t('U.S.P.S. logo'),
    '#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\\./', '', $label),
  ];
  return $build;
}