} #[Route(path: '/widgets/account/address-book', name: 'frontend.account.addressbook', options: ['seo' => true], defaults: ['XmlHttpRequest' => true, '_loginRequired' => true, '_loginRequiredAllowGuest' => true], methods: ['POST'])]
public function addressBook(Request
$request, RequestDataBag
$dataBag, SalesChannelContext
$context, CustomerEntity
$customer): Response
{ $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
);