[TwigComponent] Add tip about make:twig-component command#2384
Conversation
Kocal
left a comment
There was a problem hiding this comment.
Hi @DennisdeBest, while I find this addition very nice, I think it's too much verbose, the Twig Component documentation is already so long!
A small paragraph inside a .. tip with a simple example and a link to the MakerBundle would be enough.
We do not need to:
- tell about creating a component in a sub-directory, this should be documented in Maker's documentation
- tell what and where files were created, since the command already display this information
Thanks!
| You can also use the ``make`` commands to generate the component PHP and twig files : | ||
|
|
||
| .. code-block:: terminal | ||
|
|
||
| $ php bin/console make:twig-component Alert | ||
|
|
||
| If you want your component to reside in a sub directory like ``src/twig/Components/Alert/`` and make a specific component for a Danger alert you can run: | ||
|
|
||
| .. code-block:: terminal | ||
|
|
||
| $ php bin/console make:twig-component Alert\\Danger | ||
|
|
||
| Or: | ||
|
|
||
| .. code-block:: terminal | ||
|
|
||
| $ php bin/console make:twig-component 'Alert\Danger' | ||
|
|
||
| This wil render the php file at ``src\twig\Components\Alert\Danger.php`` and the twig file at ``templates\components\Alert\Danger.html.twig`` | ||
|
|
There was a problem hiding this comment.
| You can also use the ``make`` commands to generate the component PHP and twig files : | |
| .. code-block:: terminal | |
| $ php bin/console make:twig-component Alert | |
| If you want your component to reside in a sub directory like ``src/twig/Components/Alert/`` and make a specific component for a Danger alert you can run: | |
| .. code-block:: terminal | |
| $ php bin/console make:twig-component Alert\\Danger | |
| Or: | |
| .. code-block:: terminal | |
| $ php bin/console make:twig-component 'Alert\Danger' | |
| This wil render the php file at ``src\twig\Components\Alert\Danger.php`` and the twig file at ``templates\components\Alert\Danger.html.twig`` | |
| .. tip | |
| If you use the Symfony Maker Bundle (...): | |
| .. code-block:: terminal | |
| $ php bin/console make:twig-component Alert |
Is enough, feel free to complete the first sentence
There was a problem hiding this comment.
I'd like this block to be later in the doc... maybe with just a link here pointing at this block ?
I feel it's a bit early to tell people to run "make component" when the full concept, the paths, etc... are not yet explained
There was a problem hiding this comment.
I'm not sure to understand your point @smnandre, since above this block we already speak about the PHP file and the Twig file:

Add information on how to use the maker bundle to craete twig components, especially on how to create them in a subdirectory
make:twig-component command
|
Thank you @DennisdeBest. |
Add information on how to use the maker bundle to craete twig components, especially on how to create them in a subdirectory
#SymfonyHackday :)