Skip to content
Snippets Groups Projects
Commit e6e4bc1a authored by Larry Garfield's avatar Larry Garfield
Browse files

Merge branch 'kernel' into kernel-ajax

parents c522dad5 7b12ed6f
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -3,6 +3,7 @@
namespace Drupal\Core\EventSubscriber;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
......@@ -30,13 +31,6 @@ public function __construct(ContentNegotiation $negotiation) {
$this->negotiation = $negotiation;
}
protected function createJsonResponse() {
$response = new Response();
$response->headers->set('Content-Type', 'application/json; charset=utf-8');
return $response;
}
protected function createAjaxResponse(GetResponseEvent $event) {
$response = new Response();
$response->headers->set('Content-Type', 'application/json; charset=utf-8');
......@@ -88,9 +82,9 @@ public function onView(GetResponseEvent $event) {
public function onJson(GetResponseEvent $event) {
$page_callback_result = $event->getControllerResult();
print_r($page_callback_result);
//print_r($page_callback_result);
$response = $this->createJsonResponse();
$response = new JsonResponse();
$response->setContent($page_callback_result);
return $response;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment