[WIP][2.3][FrameworkBundle][Templating] Generate assets with absolute url#7722
[WIP][2.3][FrameworkBundle][Templating] Generate assets with absolute url#7722inoryy wants to merge 5 commits intosymfony:masterfrom inoryy:asset-url
Conversation
There was a problem hiding this comment.
A service named absolute_url is a bad idea IMO. It does not descibe at all what the service is about.
thus, making the alias target the abstract service looks weird to me
There was a problem hiding this comment.
Idea was to add a simple name that developers can reference when calling asset().
Do you think I should get rid of the alias completely or change to something else?
There was a problem hiding this comment.
What you pass as argument when calling asset() is not a service id
There was a problem hiding this comment.
You're right, misunderstood the setup. Thanks!
|
What about doing something simpler: adding a third option to the |
|
Hello everyone, Any updates on this subject? @fabpot Thanks. |
|
Closing in favor of #10451 |
…ts urls (romainneutron) This PR was merged into the 2.5-dev branch. Discussion ---------- [TwigBundle] Add possibility to generate absolute assets urls | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT | Doc PR | symfony/symfony-docs#3683 This is another approach of #7722 - [x] Add unit tests - [x] Update doc Commits ------- 76b8851 [TwigBundle] Add possibility to generate absolute assets urls
This adds support for
asset_urlhelper function, which returns asset absolute url, matching schema, host & port with server one.Relies on
RequestContextclass, so if request is made from CLI thenrouter.request_context.*parameters are needed.I've also added package alias called
absolute_url, so a developer can use it insideassetfunction.I think it's useful when
assets_base_urlsparameter is used on production and simple absolute url is needed on dev.Then a twig variable can be used, defined to be
absolute_urlon dev ornullon prod.