You are here

function uc_usps_uc_shipping_method in Ubercart 8.4

Same name and namespace in other branches
  1. 7.3 shipping/uc_usps/uc_usps.module \uc_usps_uc_shipping_method()

Implements hook_uc_shipping_method().

File

shipping/uc_usps/uc_usps.module, line 170
United States Postal Service (USPS) shipping quote module.

Code

function uc_usps_uc_shipping_method() {
  $operations = [
    'configure' => [
      'title' => t('configure'),
      'url' => Url::fromRoute('uc_usps.settings')
        ->toString(),
    ],
  ];
  $methods = [
    'usps_env' => [
      'id' => 'usps_env',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Envelope)'),
      'operations' => $operations,
      'quote' => [
        'type' => 'envelope',
        'callback' => 'uc_usps_quote',
        'accessorials' => USPSUtilities::envelopeServices(),
      ],
    ],
    'usps' => [
      'id' => 'usps',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Parcel)'),
      'operations' => $operations,
      'quote' => [
        'type' => 'small_package',
        'callback' => 'uc_usps_quote',
        'accessorials' => USPSUtilities::services(),
      ],
    ],
    'usps_intl_env' => [
      'id' => 'usps_intl_env',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Intl., Envelope)'),
      'operations' => $operations,
      'quote' => [
        'type' => 'envelope',
        'callback' => 'uc_usps_quote',
        'accessorials' => USPSUtilities::internationalEnvelopeServices(),
      ],
      'weight' => 1,
    ],
    'usps_intl' => [
      'id' => 'usps_intl',
      'module' => 'uc_usps',
      'title' => t('U.S. Postal Service (Intl., Parcel)'),
      'operations' => $operations,
      'quote' => [
        'type' => 'small_package',
        'callback' => 'uc_usps_quote',
        'accessorials' => USPSUtilities::internationalServices(),
      ],
      'weight' => 1,
    ],
  ];
  return $methods;
}