Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[WIP][2.3][FrameworkBundle][Templating] Generate assets with absolute url#7722
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
A service namedabsolute_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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Idea was to add a simple name that developers can reference when callingasset().
Do you think I should get rid of the alias completely or change to something else?
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.
What you pass as argument when callingasset() is not a service id
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're right, misunderstood the setup. Thanks!
fabpot commentedDec 31, 2013
What about doing something simpler: adding a third option to the |
qpautrat commentedMar 13, 2014
Hello everyone, Any updates on this subject?@fabpot Thanks. |
fabpot commentedMar 14, 2014
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#3683This is another approach of#7722 - [x] Add unit tests - [x] Update docCommits-------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.