You are here

function bat_options_get_operation_label in Booking and Availability Management Tools for Drupal 7

Same name and namespace in other branches
  1. 8 modules/bat_options/bat_options.module \bat_options_get_operation_label()

Given an option, return a string that explains the operation.

Parameters

$option:

Return value

string

File

modules/bat_options/bat_options.module, line 530

Code

function bat_options_get_operation_label($option) {
  $label = '';
  $currency_setting = commerce_currency_load(commerce_default_currency());
  $currency_symbol = $currency_setting['symbol'];
  switch ($option['operation']) {
    case 'add':
      $label = t('+@amount@currency_symbol to price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'add-daily':
      $label = t('+@amount@currency_symbol per night to price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'sub-daily':
      $label = t('-@amount@currency_symbol per night from price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'replace':
      $label = t('Replace price with @amount@currency_symbol', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'increase':
      $label = t('Increase price by @amount%', array(
        '@amount' => $option['value'],
      ));
      break;
    case 'decrease':
      $label = t('Decrease price by @amount%', array(
        '@amount' => $option['value'],
      ));
      break;
    case 'sub':
      $label = t('-@amount@currency_symbol from price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'add_person':
      $label = t('+@amount@currency_symbol per person to price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'add-daily_person':
      $label = t('+@amount@currency_symbol per night per person to price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'sub_person':
      $label = t('-@amount@currency_symbol per person from price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
    case 'sub-daily_person':
      $label = t('-@amount@currency_symbol per night per person from price', array(
        '@amount' => $option['value'],
        '@currency_symbol' => $currency_symbol,
      ));
      break;
  }
  return $label;
}