Skip to content

Commit 68cd9f4

Browse files
committed
minor #18215 Tweaks in the code examples of the controller early hints (javiereguiluz)
This PR was merged into the 6.3 branch. Discussion ---------- Tweaks in the code examples of the controller early hints Let's add a new and different `Link` example for a common need in web apps ... and let's tweak the code comment. Commits ------- 813398d Tweaks in the code examples of the controller early hints
2 parents c2cdd5e + 813398d commit 68cd9f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

controller.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,12 @@ method::
542542
public function index(): Response
543543
{
544544
$response = $this->sendEarlyHints([
545+
new Link(rel: 'preconnect', href: 'https://fonts.google.com'),
545546
(new Link(href: '/style.css'))->withAttribute('as', 'stylesheet'),
546547
(new Link(href: '/script.js'))->withAttribute('as', 'script'),
547548
]);
548549

549-
// Do something slow...
550+
// prepare the contents of the response...
550551

551552
return $this->render('homepage/index.html.twig', response: $response);
552553
}

0 commit comments

Comments
 (0)