$viewData =
new AddressEditorModalStruct();
$params =
[];
try { $page =
$this->addressListingPageLoader->
load($request,
$context,
$customer);
$this->
hook(new AddressBookWidgetLoadedHook($page,
$context));
$viewData->
setPage($page);
$this->
handleChangeableAddresses($viewData,
$dataBag,
$context,
$customer);
$this->
handleAddressCreation($viewData,
$dataBag,
$context,
$customer);
$this->
handleAddressSelection($viewData,
$dataBag,
$context,
$customer);
$this->
handleCustomerVatIds($dataBag,
$context,
$customer);
} catch (ConstraintViolationException
$formViolations) { $params['formViolations'
] =
$formViolations;
$params['postedData'
] =
$dataBag->
get('address'
);
} catch (\Exception
) { $viewData->
setSuccess(false
);
$viewData->
setMessages([ 'type' => self::DANGER,
'text' =>
$this->
trans('error.message-default'
),
]);
}