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

MailTheme example module for PS8 #122

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example_module_mailtheme/example_module_mailtheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private function addLayoutToCollection(ThemeCollectionInterface $themes)

$theme->getLayouts()->add(new Layout(
'customized_template',
__DIR__ . '/mails/layouts/customized_' . $theme->getName() . '_layout.html.twig',
'@Modules/example_module_mailtheme/mails/layouts/customized_' . $theme->getName() . '_layout.html.twig',
0x346e3730 marked this conversation as resolved.
Show resolved Hide resolved
'',
$this->name
));
Expand Down Expand Up @@ -211,7 +211,7 @@ private function extendOrderConfLayout(ThemeCollectionInterface $themes)
$orderIndex = $theme->getLayouts()->indexOf($orderConfLayout);
$theme->getLayouts()->offsetSet($orderIndex, new Layout(
$orderConfLayout->getName(),
__DIR__ . '/mails/layouts/extended_' . $theme->getName() . '_order_conf_layout.html.twig',
'@Modules/example_module_mailtheme/mails/layouts/extended_' . $theme->getName() . '_order_conf_layout.html.twig',
''
));
}
Expand All @@ -227,7 +227,7 @@ private function extendOrderConfLayout(ThemeCollectionInterface $themes)
*/
private function addDarkTheme(ThemeCollectionInterface $themes)
{
$scanner = new FolderThemeScanner();
$scanner = new FolderThemeScanner(_PS_MODULE_DIR_);
$darkTheme = $scanner->scan(__DIR__ . '/mails/themes/dark_modern');
if (null !== $darkTheme && $darkTheme->getLayouts()->count() > 0) {
$themes->add($darkTheme);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% extends '@!PrestaShop/Admin/layout.html.twig' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't remember, what is the interest of the initial ! ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's to be sure we use PrestaShop's template and not one from a module as it could lead to a infinite loop

{# Since PS 8.0.0 you can use @PrestaShopCore instead of @!Prestashop
(https://devdocs.prestashop-project.org/8/modules/concepts/templating/admin-views/#override-templates) #}
{% import '@PrestaShop/Admin/macros.html.twig' as ps %}
{% trans_default_domain "Admin.Design.Feature" %}

{% block content %}
Expand Down