-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form][WebProfiler] Empty form names fix #12267
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
Conversation
won't a |
It sure could, but personally I think that it would be less understandable. This fix improves usability a bit, too, IMO. |
@kix thanks for this PR! I personally love this kind of small fixes that improve the overall quality of the framework. This will lead to less confusion for developers and that's very important. I also agree that showing some explicit message, such as |
@@ -420,7 +420,11 @@ | |||
{% else %} | |||
<div class="toggle-icon empty"></div> | |||
{% endif %} | |||
{{ name }} | |||
{% if name | length %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove the spaces around the |
according to the Twig coding standards.
And I even suggest using {% if name is not empty %}
here. It will make the intent easier to understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof 👍
76411e1
to
88c5910
Compare
@webmozart Done. Is it better now? |
Yes! :) Could you add the same fix to the details view on the right? |
@@ -420,7 +420,11 @@ | |||
{% else %} | |||
<div class="toggle-icon empty"></div> | |||
{% endif %} | |||
{{ name }} | |||
{% if name is not empty %} | |||
{{ name }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply:
{{ name|default('(no name)') }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
88c5910
to
3800402
Compare
When a Form had no name, the markup was broken in the profiler, making the form tree ugly.
3800402
to
c121dea
Compare
Got it. Right-side detail view is updated in the same manner, too. |
Thank you @kix. |
This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes #12267). Discussion ---------- [Form][WebProfiler] Empty form names fix | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | none When a Form had no name, the markup was broken in the profiler, making the form tree ugly. This pull request changes the output so that `(no name)` string is displayed when no form name was available. Before:  After:  Commits ------- 6e9642a [Form][WebProfiler] Empty form names fix
When a Form had no name, the markup was broken in the profiler, making the form tree ugly. This pull request changes the output so that
(no name)
string is displayed when no form name was available.Before:

After:
