public function FaviconController::content in Favicon 8
Generates an favicon page.
1 string reference to 'FaviconController::content'
File
- lib/
Drupal/ favicon/ Controller/ FaviconController.php, line 22 - Contains \Drupal\favicon\Controller\FaviconController.
Class
- FaviconController
- Favicon page controller.
Namespace
Drupal\favicon\ControllerCode
public function content() {
// Add favicon.
if (theme_get_setting('features.favicon')) {
$favicon = theme_get_setting('favicon.url');
$type = theme_get_setting('favicon.mimetype');
$response = new Response();
$request = \Drupal::request();
$response->headers
->set('Content-Type', $type);
$response->headers
->set('Expires', 0);
$response
->setContent(file_get_contents($favicon));
$response
->prepare($request);
$response
->send();
// We are done.
exit;
}
throw new NotFoundHttpException();
}