TaxSettings.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Plugin\Ui\DataProvider;
  7. use Magento\Framework\App\Config;
  8. /**
  9. * Plugin on Data Provider for frontend ui components (Components are responsible
  10. * for rendering product on front)
  11. * This plugin provides displayTaxes setting
  12. */
  13. class TaxSettings
  14. {
  15. /**
  16. * @var Config
  17. */
  18. private $config;
  19. /**
  20. * TaxSettings constructor.
  21. * @param Config $config
  22. */
  23. public function __construct(Config $config)
  24. {
  25. $this->config = $config;
  26. }
  27. /**
  28. * Add tax data to result
  29. *
  30. * @param \Magento\Checkout\CustomerData\Cart $subject
  31. * @param array $result
  32. * @return array
  33. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  34. */
  35. public function afterGetData(\Magento\Catalog\Ui\DataProvider\Product\Listing\DataProvider $subject, $result)
  36. {
  37. $result['displayTaxes'] = $this->config
  38. ->getValue(\Magento\Tax\Model\Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE);
  39. return $result;
  40. }
  41. }