Skip to content

Commit 0349081

Browse files
committed
minor #19043 [WebLink] Adding missing "as" to style link header (weaverryan)
This PR was merged into the 6.4 branch. Discussion ---------- [WebLink] Adding missing "as" to style link header Hi! The "as" is needed for preload. Notice that it is already included in the next example, but missing here (and there is no magic where the `$this->addLink()` method adds the `as`). Cheers! Commits ------- 822ea3a Adding missing "as" to style link header
2 parents b1b12fa + 822ea3a commit 0349081

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

web_link.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ You can also add links to the HTTP response directly from controllers and servic
164164
public function index(Request $request): Response
165165
{
166166
// using the addLink() shortcut provided by AbstractController
167-
$this->addLink($request, new Link('preload', '/app.css'));
167+
$this->addLink($request, (new Link('preload', '/app.css'))->withAttribute('as', 'style'));
168168

169169
// alternative if you don't want to use the addLink() shortcut
170170
$linkProvider = $request->attributes->get('_links', new GenericLinkProvider());

0 commit comments

Comments
 (0)