Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
@ -7,8 +7,6 @@
|
|||
|
||||
namespace Drupal\Core\StackMiddleware;
|
||||
|
||||
use Drupal\Core\ContentNegotiation;
|
||||
use Drupal\Core\ContentNegotiationInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
|
@ -26,13 +24,6 @@ class NegotiationMiddleware implements HttpKernelInterface {
|
|||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The content negotiator.
|
||||
*
|
||||
* @var \Drupal\Core\ContentNegotiation
|
||||
*/
|
||||
protected $negotiator;
|
||||
|
||||
/**
|
||||
* Contains a hashmap of format as key and mimetype as value.
|
||||
*
|
||||
|
@ -45,12 +36,9 @@ class NegotiationMiddleware implements HttpKernelInterface {
|
|||
*
|
||||
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $app
|
||||
* The wrapper HTTP kernel
|
||||
* @param \Drupal\Core\ContentNegotiation $negotiator
|
||||
* The content negotiator.
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $app, ContentNegotiation $negotiator) {
|
||||
public function __construct(HttpKernelInterface $app) {
|
||||
$this->app = $app;
|
||||
$this->negotiator = $negotiator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +51,7 @@ class NegotiationMiddleware implements HttpKernelInterface {
|
|||
}
|
||||
|
||||
// Determine the request format using the negotiator.
|
||||
$request->setRequestFormat($this->negotiator->getContentType($request));
|
||||
$request->setRequestFormat($this->getContentType($request));
|
||||
return $this->app->handle($request, $type, $catch);
|
||||
}
|
||||
|
||||
|
@ -82,4 +70,31 @@ class NegotiationMiddleware implements HttpKernelInterface {
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the normalized type of a request.
|
||||
*
|
||||
* The normalized type is a short, lowercase version of the format, such as
|
||||
* 'html', 'json' or 'atom'.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The request object from which to extract the content type.
|
||||
*
|
||||
* @return string
|
||||
* The normalized type of a given request.
|
||||
*/
|
||||
protected function getContentType(Request $request) {
|
||||
// AJAX iframe uploads need special handling, because they contain a JSON
|
||||
// response wrapped in <textarea>.
|
||||
if ($request->get('ajax_iframe_upload', FALSE)) {
|
||||
return 'iframeupload';
|
||||
}
|
||||
|
||||
if ($request->query->has('_format')) {
|
||||
return $request->query->get('_format');
|
||||
}
|
||||
|
||||
// Do HTML last so that it always wins.
|
||||
return 'html';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue