forked from symfony/ux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TwigComponent][Doc] AsTwigComponent docblocks
- Loading branch information
1 parent
19b6e11
commit 6c2a4a7
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,52 @@ | |
namespace Symfony\UX\TwigComponent\Attribute; | ||
|
||
/** | ||
* An attribute to register a TwigComponent. | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component | ||
* | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_CLASS)] | ||
class AsTwigComponent | ||
{ | ||
public function __construct( | ||
/** | ||
* The component name (ie: Button). | ||
* | ||
* With the default configuration, the template path is resolved using | ||
* the component's class name. | ||
* | ||
* App\Twig\Components\Alert -> <twig:Alert /> | ||
* App\Twig\Components\Foo\Bar -> <twig:Foo:Bar /> | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component#naming-your-component | ||
*/ | ||
private ?string $name = null, | ||
|
||
/** | ||
* The template path of the component (ie: components/Button.html.twig). | ||
* | ||
* With the default configuration, the template path is resolved using | ||
* the component's name. | ||
* | ||
* Button -> templates/components/Button.html.twig | ||
* Foo:Bar -> templates/components/Foo/Bar.html.twig | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component#component-template-path | ||
*/ | ||
private ?string $template = null, | ||
|
||
/** | ||
* Whether to expose every public property as a Twig variable. | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component#passing-data-props-into-your-component | ||
*/ | ||
private bool $exposePublicProps = true, | ||
|
||
/** | ||
* The name of the special "attributes" variable in the template. | ||
*/ | ||
private string $attributesVar = 'attributes', | ||
) { | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
* in a component template (`someProp` vs `this.someProp`). These | ||
* properties must be "accessible" (have a getter). | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component#exposeintemplate-attribute | ||
* | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ | |
namespace Symfony\UX\TwigComponent\Attribute; | ||
|
||
/** | ||
* An attribute to register a PostMount hook. | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component#postmount-hook | ||
* | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_METHOD)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ | |
namespace Symfony\UX\TwigComponent\Attribute; | ||
|
||
/** | ||
* An attribute to register a PreMount hook. | ||
* | ||
* @see https://symfony.com/bundles/ux-twig-component#premount-hook | ||
* | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_METHOD)] | ||
|