protected function AddressValidator::formatSuggestedAddress in Drupal Commerce Connector for AvaTax 8
Format an address for use in modal.
Parameters
array $original: Original formatted address.
array $suggestion: Suggested formatted address.
array $fields: Fields which are different on suggestion and original address.
Return value
\Drupal\Component\Render\MarkupInterface|string Return a formatted address for use in the order request.
1 call to AddressValidator::formatSuggestedAddress()
- AddressValidator::process in src/
Controller/ AddressValidator.php - Provides address validation.
File
- src/
Controller/ AddressValidator.php, line 113
Class
- AddressValidator
- Address validator controller.
Namespace
Drupal\commerce_avatax\ControllerCode
protected function formatSuggestedAddress(array $original, array $suggestion = [], array $fields = []) {
$countries = $this->countryRepository
->getAll();
if (isset($original['country_code'])) {
$original['country_code'] = $countries[$original['country_code']] ?? $original['country_code'];
}
if (isset($suggestion['country_code'])) {
$suggestion['country_code'] = $countries[$suggestion['country_code']] ?? $suggestion['country_code'];
}
$build = [
'#theme' => 'avatax_address',
'#original' => $original,
'#suggestion' => $suggestion,
'#fields' => $fields,
];
// Render output for modal.
return $this->renderer
->renderPlain($build);
}