public function AliasController::deliverAsset in Mini site 8
Request callback to deliver a single minisite asset.
Parameters
int $asset_id: Minisite asset id.
Return value
\Symfony\Component\HttpFoundation\Response The response object.
File
- src/
Controller/ AliasController.php, line 33
Class
- AliasController
- Class AliasController.
Namespace
Drupal\minisite\ControllerCode
public function deliverAsset($asset_id) {
$asset = Asset::load($asset_id);
if (!$asset) {
throw new NotFoundHttpException();
}
try {
$render = $asset
->render();
$response = new Response($render);
} catch (\Exception $exception) {
throw new NotFoundHttpException();
}
$this
->addResponseHeaders($response, $asset);
return $response;
}