I’m a bit confused with the new way modules are created with CLI.
The legacy way to create tags e.g. {exp:my_addon:mytag}
you needed to create a function called mytag
in mod.my_addon.php
.
With the new way you create tags with the CLI e.g. php system/ee/eecli.php make:tag
.
What’s supposed to go in mod.my_addon.php
now?
Is it still possible to create tags the legacy way?
Yup! You can still do things the legacy way though it’s not ideal. The new way allows for much cleaner and maintainable code in the end and really helps with testing.
The idea being that instead of using methods to create tags and actions alongside one another, having modules with thousands of lines of code, mixing up domain logic, you segregate those into individual objects. So, every tag and action are their own, stand-alone, objects. Now, the mod.my_addon.php
file is pretty much empty (by default though there’s some advanced configuration you can do with it).
But, as mentioned, you can still continue with the legacy way for now.
FWIW, just to offer some tips, the way I do things atm is to use the CLI for everything.
eecli.php make:addon
eecli.php make:template-tag
eecli.php make:action
Once everything’s laid out, you just modify the generated files to your program needs. Basically just modify the process()
method within each exactly like we would in the legacy way.
Everything else is the same once you get the files laid out. Really, it’s more scaffolding change to the program than anything else. Just a different way to organize the code.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.