/** * Process js Layout of block * * @param array $jsLayout * @return array * @SuppressWarnings(PHPMD.NPathComplexity) */ public function process($jsLayout) { $elements = ['city' => ['visible' => $this->isCityActive(), 'formElement' => 'input', 'label' => __('City'), 'value' => null], 'country_id' => ['visible' => true, 'formElement' => 'select', 'label' => __('Country'), 'options' => $this->countryCollection->loadByStore()->toOptionArray(), 'value' => null], 'region_id' => ['visible' => true, 'formElement' => 'select', 'label' => __('State/Province'), 'options' => $this->regionCollection->load()->toOptionArray(), 'value' => null], 'postcode' => ['visible' => true, 'formElement' => 'input', 'label' => __('Zip/Postal Code'), 'value' => null]]; if (isset($jsLayout['components']['block-summary']['children']['block-shipping']['children']['address-fieldsets']['children'])) { $fieldSetPointer =& $jsLayout['components']['block-summary']['children']['block-shipping']['children']['address-fieldsets']['children']; $fieldSetPointer = $this->merger->merge($elements, 'checkoutProvider', 'shippingAddress', $fieldSetPointer); $fieldSetPointer['region_id']['config']['skipValidation'] = true; } return $jsLayout; }
/** * Retrieve country collection * * @param null|int|string|\Magento\Store\Model\Store $store * @return \Magento\Directory\Model\ResourceModel\Country\Collection */ public function getCountryCollection($store = null) { if (!$this->_countryCollection->isLoaded()) { $this->_countryCollection->loadByStore($store); } return $this->_countryCollection; }