I haven’t do much research into this so I thought I would just ask first.
I know its possible to define a layout or multiple layouts inside a module but is it possible to make the layouts inside of a specific modules override the coldbox wide default layout without having to change the config/Coldbox.cfc?
I have a layout inside my module but I can’t get it to override the parent’s default layout.
I know the default behavior is to let the parents layout to override the module’s layout however I need to reverse it so the module overrides the parent.
Look for### Public Module Properties/DirectivesNow if that is not working for you, then you may just have code that is doing this, which means you may need to change that. If any of your interceptors or handlers are changing the layout or views, which can be the case, then you may need to look at changing the way you are attempting to change the layout and views.
I have my parent app which has a layouts folder. Inside the folder it has Layout.Default.cfm
And I have a module called Theme that has a layouts folder as well and inside it, it has Layout.Theme.cfm.
When I type in siteurl.tld/theme it displays the correct layout which is Layout.Theme.cfm. However if I visit siteurl.tld/ it displays the Layout.Default.cfm.
What I am trying to figure out is how to override the Layout.Default.cfm for the parent app and all other modules? Does that make sense? I’ve read the docs you suggested again - several more times in fact but I can’t seem to get it to work the way I want. Is this even possible?
Cool - anyone else have any ideas how a module can override the parent apps’ settings? I’ve tried using an interceptor with no luck or at least the way I am trying to implement this.
To me - Modules should have a structure in the ModuleConfig.cfc that will allow me to override any parent app’s Coldbox.cfc setting.
And to be clear - I am not talking about the custom settings. I am talking about Datasources, Layouts, etc… that exists in the parent app. I know how to change them for the specific module.
My goal being to create a module that its only purpose is creating the theme of the site. That way I can drop in modules for a new project and have my theme/layouts/default views ready to go with very little configuration.
Ok so I dug into the CB code and discovered its not LayoutSettings structure but rather just defaultLayout
I was trying to mimic the structure of ColdBox.cfc & ModuleSettings.cfc however it appears to be just a root level structure and that fixed the problem. Perhaps that could be updated in the docs to make it a little clearer for people. Unless it is and i’m just an idiot and missed it.
Well I did it once with an interceptor, by just changing the conventions on the fly. Just out of couriosity what did you try? The layout can be defined in the module to be loaded, or you can change it via code by setting the layout on the preProcess().
where …/ would go up a directory because the default directory appears to be //layouts/ so it in turns becomes //layouts/…/modules/Themes/layouts/Layout.Bootstrap.Default.cfm
Apparently you can override a bunch of settings just as long as you know the specific Struct/Key.