Commit b24c1a3
committed
feature #786 [TwigComponent] Change component naming standard + optional name (weaverryan)
This PR was squashed before being merged into the 2.x branch.
Discussion
----------
[TwigComponent] Change component naming standard + optional name
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| Tickets | None
| License | MIT
Changes the naming convention of components to upper camel case + makes the `name` argument optional (defaults to class name). Components now look like:
```php
#[AsTwigComponent]
class Alert
{
public string $type = 'success';
public string $message;
}
```
The template is `templates/components/Alert.html.twig` and you render with `{{ component('Alert') }}`. This removes the need for the user to invent & keep track of an arbitrary name, but they *can* still pass a name to `AsTwigComponent`. No BC break on this.
Relates to a conversation on #771 (comment)
TODO:
* [ ] Update MakerBundle to follow this convention
Commits
-------
8dc9a7d [TwigComponent] Change component naming standard + optional nameFile tree
65 files changed
+353
-311
lines changed- src
- LiveComponent
- doc
- src/Attribute
- TwigComponent
- doc
- src
- Attribute
- DependencyInjection
- Compiler
- tests
- Fixtures
- Integration
- ux.symfony.com
- code_snippets
- src
- Controller
- Form
- Twig
- templates
- components
- live_component_demo
- live_component
- main
- turbo
- ux_packages
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
65 files changed
+353
-311
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
0 commit comments