protected function processValidate(FormInterface $form, Request $request): void
    {
        /** @var Presenter $presenter */
        $presenter = $this->getPresenter();
        if (!$presenter->isAjax()) {
            throw new BadRequestException('The validate signal is only allowed in ajax mode.');
        }

        $form->handleRequest($request);
        if (!$form->isSubmitted()) {
            throw new BadRequestException('The form was not submitted.');
        }

        $view = $this->getView();
        $errors = [];
        $this->walkErrors(
            $form->getErrors(true, false),
            $view,
            function (FormView $view) use (&$errors) {
                $errors[$view->vars['id']] = $this->renderer->searchAndRenderBlock($view, 'errors_content');
            }
        );

        $presenter->sendJson((object) ['errors' => $errors]);
    }