Create View / Layout Overrides systems for Modules


Several Scenarios

I have a module for a real estate search and results
I want to make this available so all of my 20 sites could use

They are going to want customization.
I would like the module to be smart, and look for overrides.
Inside the module, instead of using setView, maybe we could use a setModuleView which has the ability to look in multiple locations.

I would like 1 or more of these options

1 - Module looks at the theme for overrides
Look in the current theme, for an override folder, and then the module name itself. Similar to the way widgets in a theme can override the default contentbox ones.
This should be hierarchical, not all just jammed in one folder like other systems do.
Themes > Overrides > Modules > RealtorPro > Views > Results > MyListing.cfm

2 - Module looks in a Module Override Module.
Not sure if you would have a single Override module, just for that module, or if you would have a generic override folder in the contentbox core, similar to the theme. The setModuleView would be smart enough to look in there for the view, using the hierarchy.

I think this would mainly apply to views.
Module settings can be handled by the modules.
Not sure if layouts should be handler the same way or not.

But i think giving this level of overriding is needed for really powerful module distribution.
PS: This has a sister ticket, overriding themes, but i'm leaning towards a override module, or maybe just a generic override folder, so if you change theme, you dont lose the customizations.


Luis Majano
August 3, 2016, 1:51 AM
Gavin Pickin
August 3, 2016, 2:10 PM

Can you specify parent?
Or does it just use the hierarchy of how it was installed?

So if I wanted to provide overrides for this module, I should add it as a module inside a new module, so it could inherit the overrides?
But then we have to change the install location, its just not simple to manage them.

Or am I mistaken?

Luis Majano
August 4, 2016, 12:35 AM

The overrides for ANY module are at the parent level inside the `layouts` or `views` folder. Just create a `modules` folder with the name of the module. It is all documented


Luis Majano


Gavin Pickin




Fix versions

Affects versions