Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Data.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
21  protected $priceCurrency;
22 
27  public function __construct(
28  \Magento\Framework\App\Helper\Context $context,
30  ) {
31  parent::__construct($context);
32  $this->priceCurrency = $priceCurrency;
33  }
34 
43  public function currency($value, $format = true, $includeContainer = true)
44  {
45  return $format
46  ? $this->priceCurrency->convertAndFormat($value, $includeContainer)
47  : $this->priceCurrency->convert($value);
48  }
49 
59  public function currencyByStore($value, $store = null, $format = true, $includeContainer = true)
60  {
61  if ($format) {
62  $value = $this->priceCurrency->convertAndFormat(
63  $value,
64  $includeContainer,
66  $store
67  );
68  } else {
69  $value = $this->priceCurrency->convert($value, $store);
70  }
71 
72  return $value;
73  }
74 }
currency($value, $format=true, $includeContainer=true)
Definition: Data.php:43
__construct(\Magento\Framework\App\Helper\Context $context, PriceCurrencyInterface $priceCurrency)
Definition: Data.php:27
currencyByStore($value, $store=null, $format=true, $includeContainer=true)
Definition: Data.php:59
$value
Definition: gender.phtml:16
$format
Definition: list.phtml:12