40 private $dataPersistor;
45 private $postData =
null;
54 \
Magento\Customer\Model\Session $customerSession,
55 CustomerViewHelper $customerViewHelper
57 $this->_customerSession = $customerSession;
58 $this->_customerViewHelper = $customerViewHelper;
59 parent::__construct($context);
70 return $this->scopeConfig->getValue(
71 self::XML_PATH_ENABLED,
72 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE
81 public function getUserName()
83 if (!$this->_customerSession->isLoggedIn()) {
89 $customer = $this->_customerSession->getCustomerDataObject();
91 return trim($this->_customerViewHelper->getCustomerName(
$customer));
99 public function getUserEmail()
101 if (!$this->_customerSession->isLoggedIn()) {
107 $customer = $this->_customerSession->getCustomerDataObject();
120 if (
null === $this->postData) {
121 $this->postData = (array) $this->getDataPersistor()->get(
'contact_us');
122 $this->getDataPersistor()->clear(
'contact_us');
125 if (isset($this->postData[$key])) {
126 return (
string) $this->postData[$key];
137 private function getDataPersistor()
139 if ($this->dataPersistor ===
null) {
141 ->get(DataPersistorInterface::class);
144 return $this->dataPersistor;