|
12 | 12 | namespace Symfony\UX\TwigComponent\Attribute; |
13 | 13 |
|
14 | 14 | /** |
| 15 | + * An attribute to register a TwigComponent. |
| 16 | + * |
| 17 | + * @see https://symfony.com/bundles/ux-twig-component |
| 18 | + * |
15 | 19 | * @author Kevin Bond <kevinbond@gmail.com> |
16 | 20 | */ |
17 | 21 | #[\Attribute(\Attribute::TARGET_CLASS)] |
18 | 22 | class AsTwigComponent |
19 | 23 | { |
20 | 24 | public function __construct( |
| 25 | + /** |
| 26 | + * The component name (ie: Button). |
| 27 | + * |
| 28 | + * With the default configuration, the template path is resolved using |
| 29 | + * the component's class name. |
| 30 | + * |
| 31 | + * App\Twig\Components\Alert -> <twig:Alert /> |
| 32 | + * App\Twig\Components\Foo\Bar -> <twig:Foo:Bar /> |
| 33 | + * |
| 34 | + * @see https://symfony.com/bundles/ux-twig-component#naming-your-component |
| 35 | + */ |
21 | 36 | private ?string $name = null, |
| 37 | + |
| 38 | + /** |
| 39 | + * The template path of the component (ie: components/Button.html.twig). |
| 40 | + * |
| 41 | + * With the default configuration, the template path is resolved using |
| 42 | + * the component's name. |
| 43 | + * |
| 44 | + * Button -> templates/components/Button.html.twig |
| 45 | + * Foo:Bar -> templates/components/Foo/Bar.html.twig |
| 46 | + * |
| 47 | + * @see https://symfony.com/bundles/ux-twig-component#component-template-path |
| 48 | + */ |
22 | 49 | private ?string $template = null, |
| 50 | + |
| 51 | + /** |
| 52 | + * Whether to expose every public property as a Twig variable. |
| 53 | + * |
| 54 | + * @see https://symfony.com/bundles/ux-twig-component#passing-data-props-into-your-component |
| 55 | + */ |
23 | 56 | private bool $exposePublicProps = true, |
| 57 | + |
| 58 | + /** |
| 59 | + * The name of the special "attributes" variable in the template. |
| 60 | + */ |
24 | 61 | private string $attributesVar = 'attributes', |
25 | 62 | ) { |
26 | 63 | } |
|
0 commit comments