Skip to content

Commit 35a5c26

Browse files
author
romain
committed
keep only the necessary code to illustrate the LiveAction
1 parent 08e8912 commit 35a5c26

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

doc/index.rst

+1-12
Original file line numberDiff line numberDiff line change
@@ -1335,23 +1335,12 @@ Currently, Live Components do not natively support returning file responses dire
13351335

13361336
Create a LiveAction that generates the URL for the file download and returns a `RedirectResponse`::
13371337

1338-
use Symfony\Component\HttpFoundation\RedirectResponse;
1339-
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1340-
use Symfony\UX\LiveComponent\Attribute\LiveAction;
1341-
1342-
// ...
1343-
1344-
class MyDownloadButton
1345-
{
1346-
// ...
1347-
13481338
#[LiveAction]
13491339
public function initiateDownload(UrlGeneratorInterface $urlGenerator): RedirectResponse
13501340
{
13511341
$url = $urlGenerator->generate('app_file_download');
13521342
return new RedirectResponse($url);
13531343
}
1354-
}
13551344

13561345
.. code-block:: html+twig
13571346

@@ -3802,7 +3791,7 @@ uses Symfony's test client to render and make requests to your components::
38023791
// authenticate a user ($user is instance of UserInterface)
38033792
$testComponent->actingAs($user);
38043793

3805-
// set the '_locale' route parameter (if the component route is localized)
3794+
// set the '_locale' route parameter (if the component route is localized)
38063795
$testComponent->setRouteLocale('fr');
38073796

38083797
// customize the test client

0 commit comments

Comments
 (0)