-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Profiler] make it possible to omit the link var #17402
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
Currently, when you do not want to have a section in the web profiler, you would have to explicitly pass `false` as value for the `link` variable. With this change you can omit it when including the toolbar item template.
7ff7ce7
to
c430a47
Compare
@@ -1,6 +1,6 @@ | |||
<div class="sf-toolbar-block sf-toolbar-block-{{ name }} sf-toolbar-status-{{ status|default('normal') }} {{ additional_classes|default('') }}"> | |||
{% if link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %} | |||
{% if link is defined and link %}<a href="{{ path('_profiler', { token: token, panel: name }) }}">{% endif %} |
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.
Could we use {% if link|default(false) %}
instead?
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.
We could, do you think that's more readable?
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.
I don't know if this happens to others, but when I read this code: if link is defined and link
it looks to me like something is missing (try to read it as a regular English phrase ... it ends abruptly and it's weird; it should be if link is defined and link is true
).
But never mind about my comment ... let's keep your original code.
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.
Let's see what the other @symfony/deciders think. I am happy to change the code if they agree with you.
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.
@xabbuh what do you think about rename link
by show_link
? link
looks as though a URL is required to access of the profile panel IMO.
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.
In fact, the symfony core uses profile_url
instead true
, this can be confusing:
@xabbuh what was the purpose of this PR? It just seems to make the code less readable. Forcing a boolean |
@weaverryan I thought about that when removing a hint in the docs which said that the default value was |
@xabbuh I understand. How does the current Currently, it looks like you must pass |
There is any way to check if |
@weaverryan It does not (that's why the description was wrong). And this change just makes it possible that you only have to pass the variable at all if you want to have the profiler link included. |
Thank you @xabbuh. |
This PR was merged into the 3.1-dev branch. Discussion ---------- [Profiler] make it possible to omit the link var | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Currently, when you do not want to have a section in the web profiler, you would have to explicitly pass `false` as value for the `link` variable. With this change you can omit it when including the toolbar item template. Commits ------- c430a47 [Profiler] make it possible to omit the link var
…r (xabbuh) This PR was merged into the 3.1-dev branch. Discussion ---------- [Profiler] make it possible to omit the link var | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Currently, when you do not want to have a section in the web profiler, you would have to explicitly pass `false` as value for the `link` variable. With this change you can omit it when including the toolbar item template. Commits ------- c430a47 [Profiler] make it possible to omit the link var
Currently, when you do not want to have a section in the web profiler,
you would have to explicitly pass
false
as value for thelink
variable. With this change you can omit it when including the toolbar
item template.