/** * @return string */ public function getInstructions() { if ($this->getChoice()) { return json_encode($this->config->getAddressValidationInstructionsWithChoice($this->_storeManager->getStore())); } else { return json_encode($this->config->getAddressValidationInstructionsWithOutChoice($this->_storeManager->getStore())); } }
/** * @return void */ public function prepare() { $config = $this->getData('config'); if (isset($config['options'])) { $options = []; foreach ($config['options'] as $option) { $option['url'] = $this->urlBuilder->getUrl($option['url']); $options[] = $option; } $config['options'] = $options; } $store = $this->storeManager->getStore(); $config['validationEnabled'] = $this->config->isAddressValidationEnabled($store); $hasChoice = $this->config->allowUserToChooseAddress($store); if ($hasChoice) { $instructions = $this->config->getAddressValidationInstructionsWithChoice($store); } else { $instructions = $this->config->getAddressValidationInstructionsWithOutChoice($store); } $config['instructions'] = $instructions; $config['errorInstructions'] = $this->config->getAddressValidationErrorInstructions($store); $config['countriesEnabled'] = $this->config->getAddressValidationCountriesEnabled($store); $config['baseUrl'] = $this->urlBuilder->getUrl(self::VALIDATE_ADDRESS_PATH); $this->setData('config', $config); parent::prepare(); }