Skip to content

Commit

Permalink
Added additional templates for:
Browse files Browse the repository at this point in the history
* backend controller
* events
* menu
* Routes
Updated README
  • Loading branch information
leonhelmus committed Aug 25, 2019
1 parent 47017b7 commit 52813d5
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 0 deletions.
15 changes: 15 additions & 0 deletions COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This way Namespaces and vendor will be automatically filled in.

Available templates:
* **M2 class**: Default M2 php class.
* **M2 class - Backend Controller**: PHP class that extends AbstractAction.
* **M2 class - Block**: PHP class that extends Template class.
* **M2 class - Helper**: PHP class that extends AbstractHelper
* **M2 class - Observer**: PHP class that implements ObserverInterface
Expand Down Expand Up @@ -70,6 +71,13 @@ Available commands:
* **m2divirtual**: Create an virtual type
* **m2dipreference**: Create an preference(rewrite)

## M2 Events
Available templates:
* **M2 Events**: Create an events file.

Available commands:
* **m2eventobserver**: Create an observer

## M2 Extension Attribute
Available templates:
* **M2 Extension Attributes XML**: Create an extension attribute file with default structure.
Expand All @@ -78,6 +86,13 @@ Available templates:
Available templates:
* **M2 Layout XML**: Create an layout XML with default structure

## M2 Menu
Available templates:
* **M2 Menu XML**: Create an layout XML with default structure

Available commands:
* **m2menuadd**: Create an menu tag

## M2 Module
Available templates:
* **M2 Module XML**: Create an module XML file that has default structure
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ At this moment there have been live templates created for:
* ACL
* DB Schema
* DI
* Events
* Menu
* Module
* Phtml (WIP)
* Registration
Expand All @@ -32,17 +34,21 @@ These can be enabled and disabled for if you want to use them or not. If no phps
At this moment there have been templates created for:
* ACL
* Class
* Class - Backend Controller
* Class - Block
* Class - Helper
* Class - Observer
* Class - ViewModel
* Config
* DB Schema
* DI
* Events
* Extension Attributes
* Layout
* Menu
* Module
* Registration
* Routes
* Sales
* System
* System Include
Expand Down
19 changes: 19 additions & 0 deletions files/fileTemplates/M2-Class-Backend-Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php declare(strict_types=1);
#parse("M2-PHP-File-Header")

#if (${NAMESPACE})
namespace ${NAMESPACE};
#end

use Magento\Backend\App\AbstractAction;

class ${NAME} extends AbstractAction
{
/**
*
*/
public function execute()
{
#[[$END$]]#
}
}
5 changes: 5 additions & 0 deletions files/fileTemplates/M2-Events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
#parse("M2-XML-File-Header")
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
#[[$END$]]#
</config>
7 changes: 7 additions & 0 deletions files/fileTemplates/M2-Menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
#parse("M2-XML-File-Header")
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
#[[$END$]]#
</menu>
</config>
5 changes: 5 additions & 0 deletions files/fileTemplates/M2-Routes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
#parse("M2-XML-File-Header")
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
#[[$END$]]#
</config>
10 changes: 10 additions & 0 deletions files/templates/M2-events.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<templateSet group="M2-events">
<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">
<variable name="eventName" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="observerName" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="observerClass" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML_TEXT" value="true" />
</context>
</template>
</templateSet>
14 changes: 14 additions & 0 deletions files/templates/M2-menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<templateSet group="M2-menu">
<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">
<variable name="menuId" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="title" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="module" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="order" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="parentMenuId" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="controllerPath" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="resourceId" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="XML_TEXT" value="true" />
</context>
</template>
</templateSet>

0 comments on commit 52813d5

Please sign in to comment.