-
-
Notifications
You must be signed in to change notification settings - Fork 400
Twig
n98-magerun offers Twig support for i.e. code generation of new new modules. To render Twig templates we offer a twig console helper. See Helpers for more informations.
All Twig templates which are bundled inside the .phar file can be found in the folder "res/twig". You can define your own Twig templates by providing a Twig base folder in your ~/.n98-magerun.yaml (for other configs options see Config).
Define a baseDir:
twig:
baseDirs:
- path/to/my/twig/templates
- vendorNamespace
- String -> Vendor name like "N98"
- moduleName
- String -> Your defined module name
- codePool
- String -> i.e. "local"
- createBlocks
- Bool -> should blocks be created?
- createModels
- Bool -> should models be created?
- createHelpers
- Bool -> should helpers be created?
- createSetup
- Bool -> should a setup be created?
- authorName
- String: Name of author
- authorEmail
- String: Email of author
- description
-
String: Description of the module
twig└── dev└── module└── create├── app│ └── etc│ └── modules│ ├── config.twig│ ├── definition.twig│ └── readme.twig├── composer.twig└── modman.twig
You can define your own files for a new module by configuration:
N98\Magento\Command\Developer\Module\CreateCommand:
additionalFiles:
"dev/module/create/app/myfolder/test.twig": "{{moduleDir}}/myfolder/test.txt"
The first part is the twig template and the second part is the target filenanme inside the new module. You can use every Twig variable (like {{moduleName}}) inside the path of the target file. Additionally there are two variables to define for the root path of the magento installation ({{rootDir}}) and the beginning of the module ({{moduleDir}}).