diff --git a/core/core.services.yml b/core/core.services.yml index 6094635..ee319c3 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -855,10 +855,6 @@ services: arguments: ['@class_resolver', '@current_route_match', '%main_content_renderers%'] tags: - { name: event_subscriber } - accept_negotiation_406: - class: Drupal\Core\EventSubscriber\AcceptNegotiation406 - tags: - - { name: event_subscriber, priority: -10 } main_content_renderer.html: class: Drupal\Core\Render\MainContent\HtmlRenderer arguments: ['@title_resolver', '@plugin.manager.display_variant', '@event_dispatcher', '@element_info', '@module_handler', '@renderer', '@render_cache', '@cache_contexts_manager'] diff --git a/core/lib/Drupal/Core/EventSubscriber/AcceptNegotiation406.php b/core/lib/Drupal/Core/EventSubscriber/AcceptNegotiation406.php deleted file mode 100644 index db13594..0000000 --- a/core/lib/Drupal/Core/EventSubscriber/AcceptNegotiation406.php +++ /dev/null @@ -1,47 +0,0 @@ -getRequest(); - $result = $event->getControllerResult(); - - // If this is a render array then we assume that the router went with the - // generic controller and not one with a format. If the format requested is - // not HTML though we can also assume that the requested format is invalid - // so we provide a 406 response. - if (is_array($result) && $request->getRequestFormat() !== 'html') { - $result = new JsonResponse([ - 'message' => 'Not Acceptable.', - ], 406); - $event->setResponse($result); - } - } - - /** - * {@inheritdoc} - */ - static function getSubscribedEvents() { - $events[KernelEvents::VIEW][] = ['onViewDetect406', -10]; - - return $events; - } - -} diff --git a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php index 663a904..3c49597 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php @@ -11,6 +11,7 @@ use Drupal\Core\Ajax\AlertCommand; use Drupal\Core\Ajax\CloseDialogCommand; use Drupal\Core\Ajax\HtmlCommand; +use Drupal\Core\EventSubscriber\MainContentViewSubscriber; use Drupal\Core\Url; use Symfony\Component\HttpFoundation\Request; @@ -117,10 +118,11 @@ public function dialog() { $build['link'] = array( '#type' => 'link', '#title' => 'Link 1 (modal)', - '#url' => Url::fromRoute('ajax_test.dialog_contents'), + '#url' => Url::fromRoute('ajax_test.dialog_contents', array(), array( + 'query' => array(MainContentViewSubscriber::WRAPPER_ENVELOPE => 'drupal_modal'), + )), '#attributes' => array( 'class' => array('use-ajax'), - 'data-accepts' => 'application/vnd.drupal-modal', // TODO replace this. ), );