Overrides DisplayPluginBase::initDisplay
public function initDisplay(ViewExecutable $view, array &$display, array &$options = NULL) {
parent::initDisplay($view, $display, $options);
$container = drupal_container();
$negotiation = $container
->get('content_negotiation');
$request = $container
->get('request');
$request_content_type = $negotiation
->getContentType($request);
// Only use the requested content type if it's not 'html'. If it is then
// default to 'json' to aid debugging.
// @todo Remove the need for this when we have better content negotiation.
if ($request_content_type != 'html') {
$this
->setContentType($request_content_type);
}
$this
->setMimeType($request
->getMimeType($this->contentType));
}