You are here

function commerce_fedex_commerce_shipping_service_rate_options_alter in Commerce FedEx 7

Implements hook_commerce_shipping_service_rate_options_alter().

File

./commerce_fedex.module, line 70
Defines the FedEx shipping method and services for Drupal Commerce.

Code

function commerce_fedex_commerce_shipping_service_rate_options_alter(&$options, $order) {

  // If the display FedEx logo next to FedEx services is enabled in settings,
  // loop through the shipping options and add the FedEx logo to FedEx services.
  if (variable_get('commerce_fedex_show_logo', FALSE)) {
    $image = drupal_get_path('module', 'commerce_fedex') . '/images/fedex-logo.png';
    if (file_exists($image)) {
      foreach ($options as $key => &$option) {
        if (in_array(drupal_strtoupper($key), array_keys(commerce_fedex_shipping_service_types()))) {
          $option = theme('image', array(
            'path' => $image,
            'width' => '32px',
          )) . ' ' . $option;
        }
      }
    }
  }
}