public function FrontController::handle in Subrequests 3.x
Same name and namespace in other branches
- 8.2 src/Controller/FrontController.php \Drupal\subrequests\Controller\FrontController::handle()
- 8 src/Controller/FrontController.php \Drupal\subrequests\Controller\FrontController::handle()
Controller handler.
1 string reference to 'FrontController::handle'
File
- src/
Controller/ FrontController.php, line 50
Class
- FrontController
- Front controller to process Subrequests requests.
Namespace
Drupal\subrequests\ControllerCode
public function handle(Request $request) {
$data = '';
if ($request
->getMethod() === Request::METHOD_POST) {
$data = $request
->getContent();
}
elseif ($request
->getMethod() === Request::METHOD_GET) {
$data = $request->query
->get('query', '');
}
$tree = $this->blueprintManager
->parse($data, $request);
$responses = $this->subrequestsManager
->request($tree);
$master_request = $tree
->getMasterRequest();
$output_format = $master_request
->getRequestFormat();
if ($output_format === 'html') {
// Change the default format from html to multipart-related.
$output_format = 'multipart-related';
}
$master_request
->getMimeType($output_format);
return $this->blueprintManager
->combineResponses($responses, $output_format);
}