Skip to content

Commit 393880a

Browse files
committed
minor #21198 [WebLink] make use of avilable constant (JohJohan)
This PR was merged into the 6.4 branch. Discussion ---------- [WebLink] make use of avilable constant Should we show you can use constants for `preload` string with `Link::REL_PRELOAD` Commits ------- 2d5dc5e [WebLink] make use of avilable constant
2 parents eb840fd + 2d5dc5e commit 393880a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

web_link.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,12 @@ You can also add links to the HTTP response directly from controllers and servic
183183
public function index(Request $request): Response
184184
{
185185
// using the addLink() shortcut provided by AbstractController
186-
$this->addLink($request, (new Link('preload', '/app.css'))->withAttribute('as', 'style'));
186+
$this->addLink($request, (new Link(Link::REL_PRELOAD, '/app.css'))->withAttribute('as', 'style'));
187187

188188
// alternative if you don't want to use the addLink() shortcut
189189
$linkProvider = $request->attributes->get('_links', new GenericLinkProvider());
190190
$request->attributes->set('_links', $linkProvider->withLink(
191-
(new Link('preload', '/app.css'))->withAttribute('as', 'style')
191+
(new Link(Link::REL_PRELOAD, '/app.css'))->withAttribute('as', 'style')
192192
));
193193

194194
return $this->render('...');

0 commit comments

Comments
 (0)