Discount.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Block\Checkout;
  7. /**
  8. * Subtotal Total Row Renderer
  9. */
  10. class Discount extends \Magento\Checkout\Block\Total\DefaultTotal
  11. {
  12. /**
  13. * @var \Magento\Tax\Model\Config
  14. */
  15. protected $_taxConfig;
  16. /**
  17. * @param \Magento\Framework\View\Element\Template\Context $context
  18. * @param \Magento\Customer\Model\Session $customerSession
  19. * @param \Magento\Checkout\Model\Session $checkoutSession
  20. * @param \Magento\Sales\Model\Config $salesConfig
  21. * @param \Magento\Tax\Model\Config $taxConfig
  22. * @param array $layoutProcessors
  23. * @param array $data
  24. */
  25. public function __construct(
  26. \Magento\Framework\View\Element\Template\Context $context,
  27. \Magento\Customer\Model\Session $customerSession,
  28. \Magento\Checkout\Model\Session $checkoutSession,
  29. \Magento\Sales\Model\Config $salesConfig,
  30. \Magento\Tax\Model\Config $taxConfig,
  31. array $layoutProcessors = [],
  32. array $data = []
  33. ) {
  34. $this->_taxConfig = $taxConfig;
  35. parent::__construct($context, $customerSession, $checkoutSession, $salesConfig, $layoutProcessors, $data);
  36. $this->_isScopePrivate = true;
  37. }
  38. /**
  39. * @return bool
  40. */
  41. public function displayBoth()
  42. {
  43. return $this->_taxConfig->displayCartSubtotalBoth();
  44. }
  45. }