Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
7 
12 
13 class Config
14 {
18  const XML_PATH_MSRP_ENABLED = 'sales/msrp/enabled';
19  const XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE = 'sales/msrp/display_price_type';
20  const XML_PATH_MSRP_EXPLANATION_MESSAGE = 'sales/msrp/explanation_message';
21  const XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS = 'sales/msrp/explanation_message_whats_this';
25  protected $scopeConfig;
26 
30  protected $storeManager;
31 
35  protected $escaper;
36 
40  protected $storeId;
41 
47  public function __construct(
51  ) {
52  $this->scopeConfig = $scopeConfig;
53  $this->storeManager = $storeManager;
54  $this->escaper = $escaper;
55  }
56 
63  public function setStoreId($store)
64  {
65  $this->storeId = $store;
66  return $this;
67  }
68 
75  public function isEnabled()
76  {
77  return (bool)$this->scopeConfig->getValue(
78  self::XML_PATH_MSRP_ENABLED,
80  $this->storeId
81  );
82  }
83 
89  public function getDisplayActualPriceType()
90  {
91  return $this->scopeConfig->getValue(
92  self::XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE,
94  $this->storeId
95  );
96  }
97 
103  public function getExplanationMessage()
104  {
105  return $this->escaper->escapeHtml(
106  $this->scopeConfig->getValue(
107  self::XML_PATH_MSRP_EXPLANATION_MESSAGE,
109  $this->storeId
110  ),
111  ['b', 'br', 'strong', 'i', 'u', 'p', 'span']
112  );
113  }
114 
121  {
122  return $this->escaper->escapeHtml(
123  $this->scopeConfig->getValue(
124  self::XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS,
126  $this->storeId
127  ),
128  ['b', 'br', 'strong', 'i', 'u', 'p', 'span']
129  );
130  }
131 }
const XML_PATH_MSRP_EXPLANATION_MESSAGE
Definition: Config.php:20
__construct(ScopeConfigInterface $scopeConfig, StoreManagerInterface $storeManager, Escaper $escaper)
Definition: Config.php:47
const XML_PATH_MSRP_DISPLAY_ACTUAL_PRICE_TYPE
Definition: Config.php:19
const XML_PATH_MSRP_EXPLANATION_MESSAGE_WHATS_THIS
Definition: Config.php:21