You are here

public function PWAController::pwa_manifest in Progressive Web App 8

Same name and namespace in other branches
  1. 2.x src/Controller/PWAController.php \Drupal\pwa\Controller\PWAController::pwa_manifest()

Fetch the manifest content.

Parameters

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

Return value

\Symfony\Component\HttpFoundation\Response The manifest file as a response object.

1 string reference to 'PWAController::pwa_manifest'
pwa.routing.yml in ./pwa.routing.yml
pwa.routing.yml

File

src/Controller/PWAController.php, line 82
Replace values in serviceworker.js

Class

PWAController
Default controller for the pwa module.

Namespace

Drupal\pwa\Controller

Code

public function pwa_manifest(Request $request) {
  $response = new CacheableResponse($this->manifest
    ->getOutput(), 200, [
    'Content-Type' => 'application/json',
  ]);
  $meta_data = $response
    ->getCacheableMetadata();
  $meta_data
    ->addCacheTags([
    'manifestjson',
  ]);
  $meta_data
    ->addCacheContexts([
    'languages:language_interface',
  ]);
  return $response;
}