Skip to content

Commit 57b6bfd

Browse files
committed
feat: generator for sample email_templates.xml file
1 parent 6be8c46 commit 57b6bfd

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
99
- Added: Generator command for sample Layout XML file
1010
- Added: Generator command for sample page_types.xml file
1111
- Added: Generator command for sample crontab.xml file
12+
- Added: Generator command for sample email_templates.xml file
1213

1314
## [1.1.3] - 3/12/2025
1415

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
{
123123
"command": "magento-toolbox.generateCrontabXmlFile",
124124
"title": "Magento Toolbox: Generate Crontab XML"
125+
},
126+
{
127+
"command": "magento-toolbox.generateEmailTemplatesXmlFile",
128+
"title": "Magento Toolbox: Generate Email Templates XML"
125129
}
126130
],
127131
"menus": {
@@ -207,6 +211,10 @@
207211
{
208212
"command": "magento-toolbox.generateCrontabXmlFile",
209213
"when": "resourcePath =~ /app\\/code\\/.+\\/.+/i"
214+
},
215+
{
216+
"command": "magento-toolbox.generateEmailTemplatesXmlFile",
217+
"when": "resourcePath =~ /app\\/code\\/.+\\/.+/i"
210218
}
211219
]
212220
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { SimpleTemplateGeneratorCommand } from './SimpleTemplateGeneratorCommand';
2+
import { TemplateWizardData } from 'wizard/SimpleTemplateWizard';
3+
import FileHeader from 'common/xml/FileHeader';
4+
5+
export default class GenerateEmailTemplatesXmlCommand extends SimpleTemplateGeneratorCommand {
6+
constructor() {
7+
super('magento-toolbox.generateEmailTemplatesXmlFile');
8+
}
9+
10+
getWizardTitle(): string {
11+
return 'Email Templates XML File';
12+
}
13+
14+
getFileHeader(data: TemplateWizardData): string | undefined {
15+
return FileHeader.getHeader(data.module);
16+
}
17+
18+
getFilePath(data: TemplateWizardData): string {
19+
const [vendor, module] = data.module.split('_');
20+
21+
return `app/code/${vendor}/${module}/etc/email_templates.xml`;
22+
}
23+
24+
getTemplateName(data: TemplateWizardData): string {
25+
return 'xml/blank-email-templates';
26+
}
27+
}

src/command/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ export { default as GenerateLayoutXmlCommand } from './GenerateLayoutXmlCommand'
1515
export { default as GenerateWebapiXmlFileCommand } from './GenerateWebapiXmlFileCommand';
1616
export { default as GeneratePageTypesXmlCommand } from './GeneratePageTypesXmlCommand';
1717
export { default as GenerateCrontabXmlCommand } from './GenerateCrontabXmlCommand';
18+
export { default as GenerateEmailTemplatesXmlCommand } from './GenerateEmailTemplatesXmlCommand';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<% if (fileHeader) { -%>
3+
<%- fileHeader %>
4+
<% } -%>
5+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
7+
</config>

0 commit comments

Comments
 (0)