function CssAssetController::deliver

Generates an aggregate, given a filename.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request object.

string $file_name: The file to deliver.

Return value

\Symfony\Component\HttpFoundation\BinaryFileResponse|\Symfony\Component\HttpFoundation\Response The transferred file as response.

Overrides AssetControllerBase::deliver

File

core/modules/system/src/Controller/CssAssetController.php, line 48

Class

CssAssetController
Defines a controller to serve CSS aggregates.

Namespace

Drupal\system\Controller

Code

public function deliver(Request $request, string $file_name) {
  if ($request->query
    ->has('libraries') && !$request->query
    ->has('category')) {
    throw new BadRequestHttpException('Category must be passed when libraries are passed.');
  }
  if ($request->query
    ->has('category') && !$request->query
    ->has('libraries')) {
    throw new BadRequestHttpException('Libraries must be passed when category is passed.');
  }
  return parent::deliver($request, $file_name);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.