#[Route(path: '/form/contact', name: 'frontend.form.contact.send', defaults: ['XmlHttpRequest' => true, '_captcha' => true], methods: ['POST'])]
public function sendContactForm(RequestDataBag
$data, SalesChannelContext
$context): JsonResponse
{ $response =
[];
try { $message =
$this->contactFormRoute
->
load($data->
toRequestDataBag(),
$context) ->
getResult() ->
getIndividualSuccessMessage();
if (!
$message) { $message =
$this->
trans('contact.success'
);
} $response[] =
[ 'type' => 'success',
'alert' =>
$message,
];
} catch (ConstraintViolationException
$formViolations) { $violations =
[];
foreach ($formViolations->
getViolations() as $violation) {