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

[Template][Events] Introduce Context Providers for Template Blocks #14328

Merged

Conversation

coldic3
Copy link
Contributor

@coldic3 coldic3 commented Sep 19, 2022

Q A
Branch? 1.12
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets #10997 (comment)
License MIT

Since Sylius\Bundle\UiBundle\Block\BlockEventListener is deprecated, there is no easy way to add additional data to the template context before rendering. This PR introduces ContextProviderInterface that allows you to implement your own Context Provider for template blocks.

@coldic3 coldic3 force-pushed the feature/extensible-template-events-context branch 3 times, most recently from 0a4334e to 535d83c Compare September 20, 2022 06:45
@coldic3 coldic3 marked this pull request as ready for review September 20, 2022 06:50
@coldic3 coldic3 requested a review from a team as a code owner September 20, 2022 06:50
@coldic3 coldic3 added Feature New feature proposals. DX Issues and PRs aimed at improving Developer eXperience. labels Sep 20, 2022
@coldic3 coldic3 marked this pull request as draft September 20, 2022 12:46
@coldic3 coldic3 force-pushed the feature/extensible-template-events-context branch from 535d83c to 35eaf40 Compare September 20, 2022 21:08
@probot-autolabeler probot-autolabeler bot added Admin AdminBundle related issues and PRs. Shop ShopBundle related issues and PRs. labels Sep 20, 2022
@coldic3 coldic3 force-pushed the feature/extensible-template-events-context branch from 35eaf40 to ec2b0c9 Compare September 20, 2022 21:11
@coldic3 coldic3 changed the title [Template][Events] Allow setting custom context providers in template blocks [Template][Events] Allow setting custom context providers for template blocks Sep 20, 2022
@coldic3 coldic3 changed the title [Template][Events] Allow setting custom context providers for template blocks [Template][Events] Introduce Context Providers for Template Blocks Sep 20, 2022
@coldic3 coldic3 marked this pull request as ready for review September 20, 2022 21:27
Comment on lines +18 to +20
/**
* @experimental
*/
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* @experimental
*/
/** @experimental */

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot to refactor it but in the next PR, I will completely remove @experimental tags so I would be for leaving it as it is for now.

@coldic3 coldic3 force-pushed the feature/extensible-template-events-context branch from ec2b0c9 to ff89aa2 Compare September 23, 2022 06:23
@GSadee GSadee merged commit 66eb1d9 into Sylius:1.12 Sep 23, 2022
@GSadee
Copy link
Member

GSadee commented Sep 23, 2022

Thank you, Kevin! 🎉

GSadee added a commit that referenced this pull request Sep 28, 2022
…tion guide (coldic3)

This PR was merged into the 1.12 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.12                  |
| Bug fix?        | no                                                       |
| New feature?    | no                                                       |
| BC breaks?      | no                                                       |
| Deprecations?   | no |
| Related tickets | #14328                      |
| License         | MIT                                                          |

![image](https://user-images.githubusercontent.com/13316080/192718740-b269ca2d-4d9d-467c-a278-f2084155d78a.png)
![image](https://user-images.githubusercontent.com/13316080/192718830-7a6e5b53-014e-4f68-89b5-9b9f6b744bba.png)
![image](https://user-images.githubusercontent.com/13316080/192718870-b05afac1-e72e-43f2-8871-a3271691cf50.png)


Commits
-------

0ff9022 [Docs] Add Context Providers to the template customization guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs. DX Issues and PRs aimed at improving Developer eXperience. Feature New feature proposals. Shop ShopBundle related issues and PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants