We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Confused creating a module

Development and Programming

Zignature's avatar
Zignature
18 posts
2 months ago
Zignature's avatar Zignature

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?

👍 1
       
mithra62's avatar
mithra62
49 posts
2 months ago
mithra62's avatar mithra62

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.

       
Zignature's avatar
Zignature
18 posts
2 months ago
Zignature's avatar Zignature

Thanks! I’ll give the new way a go :D

I could really do with an in-depth tutorial on creating add-ons, and I think more folks could. It’s a shame there aren’t any.

       
mithra62's avatar
mithra62
49 posts
2 months ago
mithra62's avatar mithra62

Oh for sure; it’s just THAT new is all. Like only a couple weeks old. The tutorials are coming, no doubt in my mind. These guys are legit good at stewarding their community 😊

       
mithra62's avatar
mithra62
49 posts
2 months ago
mithra62's avatar mithra62

FWIW, just to offer some tips, the way I do things atm is to use the CLI for everything.

  1. Create my addon eecli.php make:addon
  2. Create my tags eecli.php make:template-tag
  3. Create my actions 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.

👍 1
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.