Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TwigComponent] Add tip about make:twig-component command #2384

Merged
merged 2 commits into from
Dec 7, 2024

Conversation

DennisdeBest
Copy link
Contributor

@DennisdeBest DennisdeBest commented Nov 16, 2024

Add information on how to use the maker bundle to craete twig components, especially on how to create them in a subdirectory

Q A
Bug fix? no
New feature? no

#SymfonyHackday :)

@carsonbot carsonbot added Bug Bug Fix Feature New Feature Status: Needs Review Needs to be reviewed labels Nov 16, 2024
Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Comment on lines 125 to 133
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``

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand your point @smnandre, since above this block we already speak about the PHP file and the Twig file:
image

@carsonbot carsonbot added Status: Needs Work Additional work is needed and removed Status: Needs Review Needs to be reviewed labels Nov 17, 2024
@smnandre smnandre added docs Improvements or additions to documentation and removed Bug Bug Fix Feature New Feature labels Nov 29, 2024
Add information on how to use the maker bundle to craete twig components, especially on how to create them in a subdirectory
@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Needs Work Additional work is needed labels Dec 7, 2024
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Dec 7, 2024
@Kocal Kocal changed the title Add maker bundle information [TwigComponent] Add tip about make:twig-component command Dec 7, 2024
@Kocal
Copy link
Member

Kocal commented Dec 7, 2024

Thank you @DennisdeBest.

@Kocal Kocal merged commit 52b64e1 into symfony:2.x Dec 7, 2024
2 checks passed
@DennisdeBest DennisdeBest deleted the patch-4 branch December 9, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants