class FaviconController in Favicon 8
Favicon page controller.
Hierarchy
- class \Drupal\favicon\Controller\FaviconController
Expanded class hierarchy of FaviconController
File
- lib/
Drupal/ favicon/ Controller/ FaviconController.php, line 17 - Contains \Drupal\favicon\Controller\FaviconController.
Namespace
Drupal\favicon\ControllerView source
class FaviconController {
/**
* Generates an favicon page.
*/
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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FaviconController:: |
public | function | Generates an favicon page. |