You are here

function commerce_ups_commerce_shipping_service_rate_options_alter in Commerce UPS 7

Same name and namespace in other branches
  1. 7.2 commerce_ups.module \commerce_ups_commerce_shipping_service_rate_options_alter()

Implements hook_commerce_shipping_service_rate_options_alter().

File

./commerce_ups.module, line 116

Code

function commerce_ups_commerce_shipping_service_rate_options_alter(&$options, $order) {

  // If the display UPS logo next to UPS services is enabled in settings,
  // loop through the shipping options and add the UPS logo to UPS services.
  if (variable_get('commerce_ups_show_logo', FALSE)) {
    $image = drupal_get_path('module', 'commerce_ups') . '/images/ups-logo.png';
    if (file_exists($image)) {
      foreach ($options as $key => &$option) {
        if (preg_match('/^ups_/', $key)) {
          $option = theme('image', array(
            'path' => $image,
            'width' => '16px',
          )) . ' ' . $option;
        }
      }
    }
  }
}