Example #1
0
 /**
  * Restore entity data from session. Entity and form code must be defined for the form.
  *
  * @param \Magento\Customer\Model\Metadata\Form $form
  * @param null $scope
  * @return \Magento\Customer\Block\Form\Register
  */
 public function restoreSessionData(\Magento\Customer\Model\Metadata\Form $form, $scope = null)
 {
     $formData = $this->getFormData();
     if (isset($formData['customer_data']) && $formData['customer_data']) {
         $request = $form->prepareRequest($formData['data']);
         $data = $form->extractData($request, $scope, false);
         $form->restoreData($data);
     }
     return $this;
 }
Example #2
0
 /**
  * Restore entity data from session
  * Entity and form code must be defined for the form
  *
  * @param \Magento\Customer\Model\Metadata\Form $form
  * @param string|null $scope
  * @return $this
  */
 public function restoreSessionData(\Magento\Customer\Model\Metadata\Form $form, $scope = null)
 {
     if ($this->getFormData()->getCustomerData()) {
         $request = $form->prepareRequest($this->getFormData()->getData());
         $data = $form->extractData($request, $scope, false);
         $form->restoreData($data);
     }
     return $this;
 }
Example #3
0
 /**
  * @magentoAppIsolation enabled
  */
 public function testRestoreData()
 {
     $attributeValues = $this->_form->restoreData($this->_form->extractData($this->_request));
     $this->assertEquals($this->_expected, $attributeValues);
 }