-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Events] Sylius template event forms #13798
Conversation
47c845d
to
0d0cd17
Compare
{{ form_errors(form) }} | ||
|
||
<div class="ui two column stackable grid"> | ||
{{ sylius_template_event('sylius.admin.channel.before_form', _context) }} |
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.
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.
yup, that could be done like this, but in sylius plus we are using more than just forms, this way we allow user to use any variable in that event. I think its more customize friendly than sending just the form.
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.
But is the form available straight from the template or behind some additional variable? I
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.
Directly.
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.
Here's some examples of it being used it other places: https://github.com/Sylius/Sylius/search?l=Twig&q=_context
src/Sylius/Bundle/AdminBundle/Resources/views/Channel/_form_content.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/Channel/_form_content.html.twig
Outdated
Show resolved
Hide resolved
Great initiative! I'm not a fan of
|
Looking for @vvasiloi and @GSadee answers we have a consensus on how to do it: sylius_ui:
events:
sylius.admin.channel.form_content:
blocks:
content:
template: '@SyliusAdmin/Channel/Form/_content.html.twig' # inside of it just enough of HTML to have columns layout
priority: 10
sylius.admin.channel.form_columns:
blocks:
first_column:
template: '@SyliusAdmin/Channel/Form/_first_column.html.twig' # inside of it just enough of HTML to single column wrapping + new event
priority: 20
second_column:
template: '@SyliusAdmin/Channel/Form/_second_column.html.twig' # inside of it just enough of HTML to single column wrapping + new event
priority: 10
sylius.admin.channel.first_form_column:
blocks:
general:
template: '@SyliusAdmin/Channel/Form/FirstColumn/_general.html.twig' # content from H4 with sylius.ui.general + block below it
priority: 20
money:
template: '@SyliusAdmin/Channel/Form/FirstColumn/_money.html.twig' # content from H4 with sylius.ui.money + block below it
priority: 10 Probably could be even more granural, but that would be great improvement already IMHO |
4b6acb5
to
4eba41b
Compare
src/Sylius/Bundle/AdminBundle/Resources/views/AdminUser/Form/_firstColumn.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/AdminUser/Form/_firstColumn.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/AdminUser/Form/_secondColumn.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/AdminUser/Form/_secondColumn.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/AdminUser/Form/_secondColumn.html.twig
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/Order/Show/Shipment/_transitions.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/Order/Show/Payment/_transitions.html.twig
Outdated
Show resolved
Hide resolved
4eba41b
to
cd1e89a
Compare
src/Sylius/Bundle/AdminBundle/Resources/views/Product/Show/_simpleProduct.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/Product/Show/_simpleProduct.html.twig
Outdated
Show resolved
Hide resolved
The base of this pull-request was changed, you need fetch and reset your local branch Unless you added new commits (to this branch) locally that you did not push yet, Feel free to ask for assistance when you get stuck 👍 |
cd5f982
to
f2a5ffa
Compare
src/Sylius/Bundle/AdminBundle/Resources/views/Product/Tab/_inventory.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/views/ProductVariant/Tab/_inventory.html.twig
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AdminBundle/Resources/config/form/events.yaml
Outdated
Show resolved
Hide resolved
content: | ||
template: '@SyliusAdmin/AdminUser/Form/_form.html.twig' | ||
priority: 10 | ||
sylius.admin.admin_user.first_column: |
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.
sylius.admin.admin_user.first_column: | |
sylius.admin.admin_user.form.first_column: |
Not including form
might create confusion or even name collision in the future.
Thank you, @SirDomin! 🥇 |
…adee) This PR was merged into the 1.10 branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | 1.10 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | after #13798, replaces #13815 | License | MIT <!-- - Bug fixes must be submitted against the 1.10 or 1.11 branch(the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits ------- 6423a5a [Admin] Move template events configs to a separate file 7ae36f7 [Admin] Clean up and refactor new template events
…nts (ernestWarwas) This PR was merged into the 1.10 branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | 1.10 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | partially #13798 | License | MIT A new event for variants content and for additional information in an admin user form. <img width="709" alt="image" src="https://user-images.githubusercontent.com/28228691/163188527-77da6d4d-1d3a-4fa0-b470-204a0333e4f3.png"> ⬇️ <img width="711" alt="image" src="https://user-images.githubusercontent.com/28228691/163188197-125d5d7f-4767-4e69-9f97-fc536b8325c7.png"> <!-- - Bug fixes must be submitted against the 1.10 or 1.11 branch(the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits ------- 127ec0f [Template][Events] new event and fix avatar in additional information aba9df4 priority added to variatns content
Introduce sylius template events on forms for easy overwriting templates.