Skip to content
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

[FrameworkBundle][HttpKernel][TwigBridge] Add an helper to generate fragments URL #40575

Merged
merged 1 commit into from Mar 30, 2021

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Mar 24, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix n/a
License MIT
Doc PR todo

This PR adds a new helper to generate raw fragment URL. Fragments will be useful to generate lazy frames with Symfony UX Turbo (symfony/ux#64). This will also be convenient when using hinclude, ESI etc in case you want full control over the generated HTML.
This is also more in sync with the new best practices we apply in the form component (generate the HTML by yourself instead of using Twig helpers hiding the HTML elements).

Example:

<turbo-frame id="set_aside_tray" src="{{ fragment_uri(controller('Symfony\Bundle\FrameworkBundle\Controller', {template: "foo.html.twig"})) }}">
  <img src="/icons/spinner.gif">
</turbo-frame>

@carsonbot
Copy link

Hey!

Cool. Good work.

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@dunglas dunglas force-pushed the feat/fragment-renderer branch 2 times, most recently from 0141b44 to ded6359 Compare March 24, 2021 18:34
@carsonbot carsonbot closed this Mar 24, 2021
@dunglas dunglas reopened this Mar 24, 2021
@dunglas dunglas marked this pull request as ready for review March 24, 2021 22:36
@dunglas dunglas requested a review from yceruto as a code owner March 24, 2021 22:36
@carsonbot carsonbot changed the title [HttpKernel][TwigBridge][FrameworkBundle] Add an helper to generate fragments URL [FrameworkBundle][HttpKernel][TwigBridge] Add an helper to generate fragments URL Mar 24, 2021
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@chalasr
Copy link
Member

chalasr commented Mar 30, 2021

Thank you @dunglas.

@chalasr chalasr merged commit 3154509 into symfony:5.x Mar 30, 2021
@dunglas dunglas deleted the feat/fragment-renderer branch March 30, 2021 14:48
derrabus added a commit that referenced this pull request Apr 6, 2021
…(dunglas)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] Fix fragment.uri_generator definition

| Q             | A
| ------------- | ---
| Branch?       | 5.x
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

Fix for a bug I introduced in #40575 (missing service).

Commits
-------

eaae450 [FrameworkBundle] Fix fragment.uri_generator definition
@fabpot fabpot mentioned this pull request Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants