@@ -110,7 +110,7 @@ Suppose you've already built a basic Twig component::
110
110
111
111
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
112
112
113
- #[AsTwigComponent() ]
113
+ #[AsTwigComponent]
114
114
class RandomNumber
115
115
{
116
116
public function getRandomNumber(): int
@@ -138,7 +138,7 @@ re-rendered live on the frontend), replace the component's
138
138
+ use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
139
139
+ use Symfony\UX\LiveComponent\DefaultActionTrait;
140
140
141
- - #[AsTwigComponent() ]
141
+ - #[AsTwigComponent]
142
142
+ #[AsLiveComponent]
143
143
class RandomNumber
144
144
{
@@ -1221,7 +1221,7 @@ You can also pass arguments to your action by adding each as a
1221
1221
</form>
1222
1222
1223
1223
In your component, to allow each argument to be passed, add
1224
- the ``#[LiveArg() ] `` attribute::
1224
+ the ``#[LiveArg] `` attribute::
1225
1225
1226
1226
// src/Twig/Components/ItemList.php
1227
1227
namespace App\Twig\Components;
@@ -1244,15 +1244,17 @@ the ``#[LiveArg()]`` attribute::
1244
1244
Actions and CSRF Protection
1245
1245
~~~~~~~~~~~~~~~~~~~~~~~~~~~
1246
1246
1247
- When you trigger an action, a POST request is sent that contains a
1248
- custom `` Accept `` header. This header is automatically populated and
1249
- validated. In other words… you get CSRF protection without any work
1250
- thanks to same-origin / CORS policies implemented by browsers.
1247
+ When an action is triggered , a POST request is sent with a custom `` Accept ``
1248
+ header. This header is automatically set and validated for you. In other
1249
+ words, you benefit from CSRF protection effortlessly, thanks to the
1250
+ `` same-origin `` and `` CORS `` policies enforced by browsers.
1251
1251
1252
- If you want this built-in CSRF protection to be effective, mind your
1253
- CORS headers (e.g. *DO NOT * use `Access-Control-Allow-Origin: * `).
1252
+ .. warning ::
1254
1253
1255
- (In test-mode, the CSRF protection is disabled to make testing easier.)
1254
+ To ensure this built-in CSRF protection remains effective, pay attention
1255
+ to your CORS headers (e.g. *DO NOT * use ``Access-Control-Allow-Origin: * ``).
1256
+
1257
+ In test-mode, the CSRF protection is disabled to make testing easier.
1256
1258
1257
1259
Actions, Redirecting and AbstractController
1258
1260
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2972,7 +2974,7 @@ However, if the user adds a *new* todo item then we *do* want the ``TodoFooter``
2972
2974
child component to re-render: using the new ``count `` value. To trigger this,
2973
2975
in the ``TodoFooter `` component, add the ``updateFromParent `` option::
2974
2976
2975
- #[LiveComponent() ]
2977
+ #[LiveComponent]
2976
2978
class TodoFooter
2977
2979
{
2978
2980
#[LiveProp(updateFromParent: true)]
0 commit comments