diff --git a/src/Resources/config/routing/admin.yaml b/src/Resources/config/routing/admin.yaml index 2800cee..866af25 100644 --- a/src/Resources/config/routing/admin.yaml +++ b/src/Resources/config/routing/admin.yaml @@ -12,6 +12,7 @@ monsieurbiz_sylius_cms_page_admin: subheader: monsieurbiz_cms_page.ui.pages_subheader templates: form: "@MonsieurBizSyliusCmsPagePlugin/Admin/Page/_form.html.twig" + toolbar: "@MonsieurBizSyliusCmsPagePlugin/Admin/Page/Update/_toolbar.html.twig" index: icon: 'file alternate' type: sylius.resource diff --git a/src/Resources/translations/messages.en.yaml b/src/Resources/translations/messages.en.yaml index 7c32d90..050ff97 100644 --- a/src/Resources/translations/messages.en.yaml +++ b/src/Resources/translations/messages.en.yaml @@ -17,5 +17,7 @@ monsieurbiz_cms_page: meta_title: "Meta Title" meta_description: "Meta Description" meta_keywords: "Meta Keyword" + show_in: "Show in" + show_page_in_shop_page: "Show page in shop page" actions: create: 'Create a new page' diff --git a/src/Resources/translations/messages.fr.yaml b/src/Resources/translations/messages.fr.yaml index ee1c0fe..c5c4a55 100644 --- a/src/Resources/translations/messages.fr.yaml +++ b/src/Resources/translations/messages.fr.yaml @@ -17,5 +17,7 @@ monsieurbiz_cms_page: meta_title: "Meta Title" meta_description: "Meta Description" meta_keywords: "Meta Keyword" + show_in: "Afficher dans" + show_page_in_shop_page: "Afficher la page dans la boutique" actions: create: 'Créer une nouvelle page' diff --git a/src/Resources/views/Admin/Page/Update/_toolbar.html.twig b/src/Resources/views/Admin/Page/Update/_toolbar.html.twig new file mode 100644 index 0000000..44e4387 --- /dev/null +++ b/src/Resources/views/Admin/Page/Update/_toolbar.html.twig @@ -0,0 +1,3 @@ +
diff --git a/src/Resources/views/Admin/Page/_showInShopButton.html.twig b/src/Resources/views/Admin/Page/_showInShopButton.html.twig new file mode 100644 index 0000000..1fe3c51 --- /dev/null +++ b/src/Resources/views/Admin/Page/_showInShopButton.html.twig @@ -0,0 +1,37 @@ +{% set enabledChannels = resource.channels|filter(channel => channel.enabled == true) %} + +{% if sylius_bundle_loaded_checker('SyliusShopBundle') %} + {% if not resource.enabled or enabledChannels|length < 1 %} + + + {{ 'monsieurbiz_cms_page.ui.show_page_in_shop_page'|trans }} + + {% elseif enabledChannels|length > 1 %} + + {% else %} + {% for channel in enabledChannels %} + {% set url = channel.hostname is not null ? 'http://' ~ channel.hostname ~ path('monsieurbiz_cms_page_show', {'slug': resource.slug, '_locale': channel.defaultLocale.code}) : url('monsieurbiz_cms_page_show', {'slug': resource.slug, '_locale': channel.defaultLocale.code}) %} + + + {{ 'monsieurbiz_cms_page.ui.show_page_in_shop_page'|trans }} + + {% endfor %} + {% endif %} +{% endif %}