You are here

public function WebformEntityController::css in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Controller/WebformEntityController.php \Drupal\webform\Controller\WebformEntityController::css()

Returns a webform's CSS.

Parameters

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

\Drupal\webform\WebformInterface $webform: The webform.

Return value

\Symfony\Component\HttpFoundation\Response|\Drupal\Core\Cache\CacheableResponse The response object.

1 string reference to 'WebformEntityController::css'
webform.routing.yml in ./webform.routing.yml
webform.routing.yml

File

src/Controller/WebformEntityController.php, line 90

Class

WebformEntityController
Provides route responses for Webform entity.

Namespace

Drupal\webform\Controller

Code

public function css(Request $request, WebformInterface $webform) {
  $assets = $webform
    ->getAssets();
  if ($webform
    ->access('update')) {
    return new WebformUncacheableResponse($assets['css'], 200, [
      'Content-Type' => 'text/css',
    ]);
  }
  else {
    return new CacheableResponse($assets['css'], 200, [
      'Content-Type' => 'text/css',
    ]);
  }
}