[Admin] Render view in store button in the variant edit page

This commit is contained in:
Rafikooo 2024-07-23 14:04:52 +02:00
parent 6a1cdaaf0d
commit a046ac804b
No known key found for this signature in database
GPG key ID: 4A26D8327BC2442B
2 changed files with 9 additions and 5 deletions

View file

@ -13,6 +13,9 @@ twig_hooks:
'sylius_admin.product_variant.update.content.header.title_block.actions':
price_history:
template: '@SyliusAdmin/product_variant/form/content/update/header/actions/price_history.html.twig'
view_in_store:
template: '@SyliusAdmin/product/common/header/title_block/actions/view_in_store.html.twig'
'sylius_admin.product_variant.update.content.form':
side_navigation:

View file

@ -1,9 +1,9 @@
{% from '@SyliusAdmin/shared/helper/icon.html.twig' import icon %}
{% set product = (hookable_metadata.context.resource) %}
{% set enabled_channels = product.channels|filter(channel => channel.enabled == true) %}
{% if sylius_bundle_loaded_checker('SyliusShopBundle') %}
{% from '@SyliusAdmin/shared/helper/icon.html.twig' import icon %}
{% set product = hookable_metadata.context.resource.product|default(hookable_metadata.context.resource) %}
{% set enabled_channels = product.channels|filter(channel => channel.enabled == true) %}
{% if not product.enabled or enabled_channels|length < 1 %}
<a class="btn disabled" href="{{ (url is not defined) ? '#' : url|raw }}" target="_blank" {{ sylius_test_html_attribute('view-in-store') }}>
{{ icon({ icon: 'arrow_up_right', class: 'icon icon-tabler' }) }}
@ -26,6 +26,7 @@
class="dropdown-item{% if url is not defined %} disabled{% endif %}"
href="{{ (url is not defined) ? '#' : url|raw }}"
target="_blank"
{{ sylius_test_html_attribute('channel-code', channel.code) }}
>
{{ icon({ icon: 'arrow_up_right', class: 'icon dropdown-item-icon icon-tabler' }) }}
{{ channel.name }} ({{ channel.code }})