Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddressModal.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Block\Form;
10 
14 class AddressModal extends Form
15 {
21  private $saveButton = '.action-save-address';
22 
28  private $cancelButton = '.action-hide-popup';
29 
35  private $errorMessage = '.field-error';
36 
42  private $errorField = '._error';
43 
49  private $fieldLabel = '.label';
50 
56  public function save()
57  {
58  $this->_rootElement->find($this->saveButton)->click();
59  }
60 
66  public function cancel()
67  {
68  $this->_rootElement->find($this->cancelButton)->click();
69  }
70 
76  public function getErrorMessages()
77  {
78  $result = [];
79  foreach ($this->_rootElement->getElements($this->errorField) as $item) {
80  $result[$item->find($this->fieldLabel)->getText()] = $item->find($this->errorMessage)->getText();
81  }
82 
83  return $result;
84  }
85 
93  protected function dataMapping(array $fields = null, $parent = null)
94  {
95  if (isset($fields['custom_attribute'])) {
96  $this->placeholders = ['attribute_code' => $fields['custom_attribute']['code']];
97  $this->applyPlaceholders();
98  }
99  return parent::dataMapping($fields, $parent);
100  }
101 }
$fields
Definition: details.phtml:14