[1.5.5] Plugin inside layout folder

Hi, there,
I create a plugin and the only wat it works is by placing it inside: contentbox/plugins
bu I would like to place it inside: contentbox/layouts/mylayout/plugins, is this possible?



Yes, it is.

When you call it how are you calling it?

I probably should elaborate some there, widgets are plugins as well.

Can you elaborate to what your plugin is going to do, because I am sure it would best be served as a widget instead.

Hi Andrew,

Practically is a plugin to format strings, nothing fancy just wanna to know how plugins get around contentbox, the way Im calling it is like this:

getPlugin( plugin=“Stringformatter”, customPlugin=“true”)



Sorry: layouts/mylayout/plugins/Stringformatter

If you want to look at string formatting, that is to be used inside your layout but for code purposes, you may need to add an interceptor to add the plugin path to the system. This makes it hard if you wish to distribute the layout.

This is where sometime I think ContentBox layouts should be modules as well, that way it makes it fully self contained.

But if it is for formatting strings to the user, then using the CBHelper could work here as well. For example you could in your handler do something like this.

myHandler() {
var newString = cb.widget(“your layout widget”).convert(“string to be converted”);


This way you can access code within your widget, to do what you need to do. Sort of containing plugin functionality, with ContentBox functionality isn’t that bad of an idea.

Hope that gets you in the right direction.

That would be great to handle layouts as modules, I wasn’t focusing in formatting strings, I just was trying to know how plugins work, and where to place them, at first I though it would be great to include them inside my layout folder, since is not “possible” maybe investing time in widgets is the way to go in terms of functionality within contentbox.

Thank you Andrew,


No problem.

Widgets is one way, it depends on what your needs and wants are. But for basic output etc, aka viewlets so to speak, widgets are the way.

Layouts are, in a sense modules, but have very limited information etc., which is understandable why they do. But there are ways to get around things, if you sort of explore a bit. But becomes limited depending on how and if, you are going to distribute things. As always where there is a will there is a way.

You can put them in your layouts but as widgets so you can retrieve then just by name.

If you want to use global plugins then they must follow the ColdBox rules. In the parent or inside any module.

Luis Majano
Ortus Solutions, Corp
Toll Free/Fax: 1-888-557-8057
Direct: 909-248-3408
Twitter: @lmajano, @ortussolutions

Thank you Luis!