A New Way To Look At Add-On Development
12/21/2022 / By Andy McCormick
ExpressionEngine 7.5 has been Released! Learn More!
12/21/2022 / By Andy McCormick
With the release of ExpressionEngine 7.2.5, we’re excited to reveal a shift in how ExpressionEngine users will look at custom add-on development.
First, we’ve refactored how we talk about add-ons. No more talking about building a fieldtype vs. an extension or a module vs. a plugin. Now, ExpressionEngine users simply build an add-on and will add functionality to their add-on as it is needed. This has really been happening ever since ExpressionEngine 3, but the shift in how developers and the Core view add-ons was never really expressed in the docs.
Second, we’ve updated the CLI and the core to make building add-ons incredibly easy for users of any skill level.
We’re hoping that with this release, users will no longer see a barrier, and more users will be willing to try their hands at custom add-on development.
After the new add-on manager in ExpressionEngine 3 there was no longer a division in add-on types (plugins, extensions, fieldtypes, modules, etc), everything was listed one page. Likewise, installing add-ons became easier with the addon.setup.php
file. However, despite all the changes, the docs have always reflected a mix of the old and the new. Today, we’re changing that.
From now on, a developer is no longer building different types of add-ons but rather simply building an add-on. An add-on can have many types of functionality included with it, though. A single add-on can have multiple fieldtypes, hook into several core hooks, introduce custom template tags, and much more. This is how the docs now refer to add-on development. With a mix of references and guides, the docs will now walk users through the complete structure of an add-on and how to add any functionality they need to their add-on.
Get started today with the new Add-On Development Overview section in the docs.
The new CLI was introduced with ExpressionEngine 6.1 with basic commands for making different types of add-ons and other functions to help developers work more efficiently. With 7.2.5, we’ve refactored some of the commands around add-on creation as well as updated the core to make creating add-ons easier than ever before.
Get started with simply make:addon
, which will generate the start of an add-on for you with everything you need. Add a Control Panel page to your add-on with make:cp-route
. This command will generate a route for your add-on (think settings, configurations, and more), a corresponding view, and even update the addon.setup.php
to indicate this add-on now has a settings page. Need to add an action? Just use make:action
, and the CLI will generate your action along with a migration so your action will automatically be installed when your add-on is distributed. All methods and files are automatically created, set up, and ready to go for all CLI make
commands.
These are just a few examples of all the great things the CLI will do for you. Check out the docs to start building your add-on.
Of course, to make all this possible, we also updated the Core.
In ExpressionEngine 7.2 we released a new way to build add-ons that focused more on a library of services and a new style that was more object-oriented. We felt this was a great direction for ExpressionEngine. To be honest, we got it part right. It was a great direction, but we missed the mark with the implementation. We removed the docs around this and then took some time to reflect on how we can do this, but do it even better.
We’ve spent the last several weeks revamping services around add-on development. Yes, the old ways will still work for now, but we’re honestly not going to talk about that way anymore. The days of having twenty template tags in mod.my_addon.php
are done. Now, all your tags are individual classes in your Tags
folder. Not only that, the CLI will generate everything for you. All you need to do is add the business logic. Likewise, sidebars for Control Panel pages can quickly be generated without even having to create a sidebar array, just use make:sidebar
. These are only a couple of examples. Reading through the new add-on development docs, you will easily see the new way to build add-ons. This is ExpressionEngine add-on development in the best form it’s ever been.
Many will ask why or what’s the big deal. If you’ve built add-ons in ExpressionEngine, then you probably already see why this is a big deal. Add-ons bring a lot of power to ExpressionEngine sites, and we hope that with this new paradigm, the barrier to add-on development will begin to fall. Anyone should be able to create a template tag or a fieldtype, and it shouldn’t take them long to do so. Who thought we could have a working custom fieldtype in under 1 minute? This is how ExpressionEngine add-on development should be.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.