-
-
Notifications
You must be signed in to change notification settings - Fork 364
Props tag remove props from the attribute list #1041
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
Changes from all commits
2d9f300
a9d422e
2555d26
66b7f58
416c46a
f6ac821
58fce65
6f693d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Symfony\UX\TwigComponent\Tests\Fixtures; | ||
|
||
class User | ||
{ | ||
public function __construct( | ||
private readonly string $name, | ||
private readonly string $email, | ||
) {} | ||
|
||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function getEmail(): string | ||
{ | ||
return $this->email; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<twig:UserCard :user='user' class='foo'/> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% props user %} | ||
|
||
<div {{ attributes }}> | ||
<p>{{ user.name }}</p> | ||
<p>{{ user.email }}</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add and test for this:
This is the last thing to fix. I just tested locally. Everything works great (
|
||
<p>class variable defined? {{ class is defined ? 'yes': 'no' }}</p> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that props that were passed to anonymous components became attributes unless you used the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No the props tag only allow to set default value on attributes or to required attributes, but all props are at first an attribute There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that, if we added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also misunderstood. I think this could make
Feel like this should be the case as I don't think there's any other way to make the distinction. |
Uh oh!
There was an error while loading. Please reload this page.