Skip to content

Commit

Permalink
refactor #15417 [DX][Checkout][ShippingMethod] Dispatch new ui events…
Browse files Browse the repository at this point in the history
… (Jibbarth, GSadee)

This PR was merged into the 1.13 branch.

Discussion
----------


| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 <!-- see the comment below -->                  |
| Bug fix?        | no                                                       |
| New feature?    | yes                                                       |
| BC breaks?      | no                                                       |
| Deprecations?   | no <!-- don't forget to update the UPGRADE-*.md file --> |
| Related tickets | N/A                      |
| License         | MIT                                                          |


Following #15384, this add a `sylius.shop.checkout.select_shipping.choice_item_content` and a `sylius.shop.checkout.select_shipping.choice_item_extra` ui events.

Description and fee are now extracted and injected through this new events



Commits
-------

d9e799e [DX][Checkout][ShippingMethod] Dispatch new ui events
0ad2c0f Merge branch '1.13' into feature/ui-event-for-select-shipping
  • Loading branch information
GSadee committed Apr 23, 2024
2 parents cdd979b + 0ad2c0f commit ecb8430
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
14 changes: 12 additions & 2 deletions src/Sylius/Bundle/ShopBundle/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1029,17 +1029,27 @@ sylius_ui:
context:
event: sylius.shop.checkout.select_payment.before_navigation

sylius.shop.checkout.select_payment.choice_item_content:
blocks:
description:
template: "@SyliusShop/Checkout/SelectPayment/_description.html.twig"

sylius.shop.checkout.select_shipping.before_navigation:
blocks:
legacy:
template: "@SyliusUi/Block/_legacySonataEvent.html.twig"
context:
event: sylius.shop.checkout.select_shipping.before_navigation

sylius.shop.checkout.select_payment.choice_item_content:
sylius.shop.checkout.select_shipping.choice_item_content:
blocks:
description:
template: "@SyliusShop/Checkout/SelectPayment/_description.html.twig"
template: "@SyliusShop/Checkout/SelectShipping/_description.html.twig"

sylius.shop.checkout.select_shipping.choice_item_extra:
blocks:
shipping_fee:
template: "@SyliusShop/Checkout/SelectShipping/_fee.html.twig"

sylius.shop.product.show.left_sidebar:
blocks:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% import '@SyliusShop/Common/Macro/money.html.twig' as money %}

<div class="item" {{ sylius_test_html_attribute('shipping-item') }}>
<div class="field">
<div class="ui radio checkbox" {{ sylius_test_html_attribute('shipping-method-checkbox') }}>
Expand All @@ -8,15 +6,9 @@
</div>
<div class="content">
<a class="header" {{ sylius_test_html_attribute('shipping-method-label') }}>{{ form_label(form) }}</a>
{% if method.description is not null %}
<div class="description">
<p>{{ method.description }}</p>
</div>
{% endif %}
{{ sylius_template_event('sylius.shop.checkout.select_shipping.choice_item_content', {'method': method, 'fee': fee}) }}
</div>
<div class="extra">
<div class="ui large right floated fee label" {{ sylius_test_html_attribute('shipping-method-fee') }}>
{{ money.convertAndFormat(fee) }}
</div>
{{ sylius_template_event('sylius.shop.checkout.select_shipping.choice_item_extra', {'method': method, 'fee': fee}) }}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if method.description is not null %}
<div class="description">
<p>{{ method.description }}</p>
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% import '@SyliusShop/Common/Macro/money.html.twig' as money %}

<div class="ui large right floated fee label" {{ sylius_test_html_attribute('shipping-method-fee') }}>
{{ money.convertAndFormat(fee) }}
</div>

0 comments on commit ecb8430

Please sign in to comment.