Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e697b2

Browse files
committed
minor#10621 Documented the addLink() shortcut (javiereguiluz)
This PR was merged into the master branch.Discussion----------Documented the addLink() shortcutThisfixes#10612 and#10564.Commits-------26817be Documented the addLink() shortcut
2 parents4fc5a88 +26817be commit0e697b2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎weblink.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,20 @@ You can also add links to the HTTP response directly from controllers and servic
147147
{
148148
public function index(Request $request)
149149
{
150+
// using the addLink() shortcut provided by AbstractController
151+
$this->addLink($request, new Link('preload', '/app.css'));
152+
153+
// alternative if you don't want to use the addLink() shortcut
150154
$linkProvider = $request->attributes->get('_links', new GenericLinkProvider());
151155
$request->attributes->set('_links', $linkProvider->withLink(new Link('preload', '/app.css')));
152156

153157
return $this->render('...');
154158
}
155159
}
156160

161+
..versionadded::4.2
162+
The ``addLink()`` shortcut was introduced in Symfony 4.2.
163+
157164
..seealso::
158165

159166
WebLink can be used:doc:`as a standalone PHP library</components/weblink>`

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp