You are here

public static function Utility::getTotalPriceMarkupData in Basic cart 8

Same name and namespace in other branches
  1. 8.6 src/Utility.php \Drupal\basic_cart\Utility::getTotalPriceMarkupData()
  2. 8.0 src/Utility.php \Drupal\basic_cart\Utility::getTotalPriceMarkupData()
  3. 8.2 src/Utility.php \Drupal\basic_cart\Utility::getTotalPriceMarkupData()
  4. 8.3 src/Utility.php \Drupal\basic_cart\Utility::getTotalPriceMarkupData()
  5. 8.4 src/Utility.php \Drupal\basic_cart\Utility::getTotalPriceMarkupData()
  6. 8.5 src/Utility.php \Drupal\basic_cart\Utility::getTotalPriceMarkupData()
1 call to Utility::getTotalPriceMarkupData()
CartForm::buildForm in src/Form/CartForm.php
Form constructor.

File

src/Utility.php, line 282
Contains \Drupal\basic_cart\Utility

Class

Utility

Namespace

Drupal\basic_cart

Code

public static function getTotalPriceMarkupData() {
  $config = Utility::cartSettings();
  $price = Utility::getTotalPrice();
  $total = Utility::formatPrice($price->total);
  $vat_is_enabled = (int) $config
    ->get('vat_state');
  $vat_value = !empty($vat_is_enabled) && $vat_is_enabled ? Utility::formatPrice($price->vat) : 0;
  $basic_cart = array(
    'total_price' => $total,
    'vat_enabled' => $vat_is_enabled,
    'vat_value' => $vat_value,
    'total_price_label' => $config
      ->get('total_price_label'),
    'total_vat_label' => 'Total VAT',
  );
  return $basic_cart;
}