Skip to content

Commit 52813d5

Browse files
committed
Added additional templates for:
* backend controller * events * menu * Routes Updated README
1 parent 47017b7 commit 52813d5

File tree

8 files changed

+81
-0
lines changed

8 files changed

+81
-0
lines changed

COMMANDS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This way Namespaces and vendor will be automatically filled in.
2323

2424
Available templates:
2525
* **M2 class**: Default M2 php class.
26+
* **M2 class - Backend Controller**: PHP class that extends AbstractAction.
2627
* **M2 class - Block**: PHP class that extends Template class.
2728
* **M2 class - Helper**: PHP class that extends AbstractHelper
2829
* **M2 class - Observer**: PHP class that implements ObserverInterface
@@ -70,6 +71,13 @@ Available commands:
7071
* **m2divirtual**: Create an virtual type
7172
* **m2dipreference**: Create an preference(rewrite)
7273

74+
## M2 Events
75+
Available templates:
76+
* **M2 Events**: Create an events file.
77+
78+
Available commands:
79+
* **m2eventobserver**: Create an observer
80+
7381
## M2 Extension Attribute
7482
Available templates:
7583
* **M2 Extension Attributes XML**: Create an extension attribute file with default structure.
@@ -78,6 +86,13 @@ Available templates:
7886
Available templates:
7987
* **M2 Layout XML**: Create an layout XML with default structure
8088

89+
## M2 Menu
90+
Available templates:
91+
* **M2 Menu XML**: Create an layout XML with default structure
92+
93+
Available commands:
94+
* **m2menuadd**: Create an menu tag
95+
8196
## M2 Module
8297
Available templates:
8398
* **M2 Module XML**: Create an module XML file that has default structure

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ At this moment there have been live templates created for:
1919
* ACL
2020
* DB Schema
2121
* DI
22+
* Events
23+
* Menu
2224
* Module
2325
* Phtml (WIP)
2426
* Registration
@@ -32,17 +34,21 @@ These can be enabled and disabled for if you want to use them or not. If no phps
3234
At this moment there have been templates created for:
3335
* ACL
3436
* Class
37+
* Class - Backend Controller
3538
* Class - Block
3639
* Class - Helper
3740
* Class - Observer
3841
* Class - ViewModel
3942
* Config
4043
* DB Schema
4144
* DI
45+
* Events
4246
* Extension Attributes
4347
* Layout
48+
* Menu
4449
* Module
4550
* Registration
51+
* Routes
4652
* Sales
4753
* System
4854
* System Include
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1);
2+
#parse("M2-PHP-File-Header")
3+
4+
#if (${NAMESPACE})
5+
namespace ${NAMESPACE};
6+
#end
7+
8+
use Magento\Backend\App\AbstractAction;
9+
10+
class ${NAME} extends AbstractAction
11+
{
12+
/**
13+
*
14+
*/
15+
public function execute()
16+
{
17+
#[[$END$]]#
18+
}
19+
}

files/fileTemplates/M2-Events.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
#parse("M2-XML-File-Header")
3+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
4+
#[[$END$]]#
5+
</config>

files/fileTemplates/M2-Menu.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
#parse("M2-XML-File-Header")
3+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
4+
<menu>
5+
#[[$END$]]#
6+
</menu>
7+
</config>

files/fileTemplates/M2-Routes.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
#parse("M2-XML-File-Header")
3+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
4+
#[[$END$]]#
5+
</config>

files/templates/M2-events.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<templateSet group="M2-events">
2+
<template name="m2eventobserver" value="&lt;event name=&quot;$eventName$&quot;&gt;&#10; &lt;observer name=&quot;$observerName$&quot; instance=&quot;$observerClass$&quot;/&gt;&#10;&lt;/event&gt;&#10;$END$" description="create an observer on event" toReformat="false" toShortenFQNames="true">
3+
<variable name="eventName" expression="" defaultValue="" alwaysStopAt="true" />
4+
<variable name="observerName" expression="" defaultValue="" alwaysStopAt="true" />
5+
<variable name="observerClass" expression="" defaultValue="" alwaysStopAt="true" />
6+
<context>
7+
<option name="XML_TEXT" value="true" />
8+
</context>
9+
</template>
10+
</templateSet>

files/templates/M2-menu.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<templateSet group="M2-menu">
2+
<template name="m2menuadd" value="&lt;add id=&quot;$menuId$&quot; title=&quot;$title$&quot; translate=&quot;title&quot; module=&quot;$module$&quot; sortOrder=&quot;$order$&quot; parent=&quot;$parentMenuId$&quot; action=&quot;$controllerPath$&quot; resource=&quot;$resourceId$&quot;/&gt;" description="Add new menu" toReformat="false" toShortenFQNames="true">
3+
<variable name="menuId" expression="" defaultValue="" alwaysStopAt="true" />
4+
<variable name="title" expression="" defaultValue="" alwaysStopAt="true" />
5+
<variable name="module" expression="" defaultValue="" alwaysStopAt="true" />
6+
<variable name="order" expression="" defaultValue="" alwaysStopAt="true" />
7+
<variable name="parentMenuId" expression="" defaultValue="" alwaysStopAt="true" />
8+
<variable name="controllerPath" expression="" defaultValue="" alwaysStopAt="true" />
9+
<variable name="resourceId" expression="" defaultValue="" alwaysStopAt="true" />
10+
<context>
11+
<option name="XML_TEXT" value="true" />
12+
</context>
13+
</template>
14+
</templateSet>

0 commit comments

Comments
 (0)