[Profiler] make it possible to omit the link var#17402
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
There was a problem hiding this comment.
Could we use {% if link|default(false) %} instead?
There was a problem hiding this comment.
We could, do you think that's more readable?
There was a problem hiding this comment.
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.
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.
@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.
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
falseas value for thelinkvariable. With this change you can omit it when including the toolbar
item template.