Is it intentional that calling renderView() with a view argument value
within a module does not check the current module's view path without
also specifying the module argument?
I find this a bit verbose that I have to explicitly specify the module
name when I call renderView within my modules.
I'd prefer it is the Renderer would default the module argument to the
current module. I could still rely on the viewParentLookup setting
to check the parent application's views first if needed, and it would
save me adding module = event.getCurrentModule() to every renderView
call.
Interesting, ran into this issue yesterday when trying to make one of my modules run as a stand alone app as well.
It would make sense that the renderView(view) would work without the Module=“ModuleName” argument. Then I don’t have to worry if the module is running as a module or an app.
Where are you using a direct renderView() call, renderView() is an explicit rendering, thus you need to explicit tell it what to render. You cannot assume the surroundings with it as it could be anywhere.
Yeah it is a direct renderView() call. I think all the logic is in
Renderer to make this easier on us. If the module argument defaulted
to event.getCurrentModule() it would resolve the view based on the
parentViewLookup setting when rendering within a module (as
renderView() does now sans view argument). It would just be an empty
string when renderView was called from the host application so there
is no harm there.
Almost all my modules will be self contained (standalone apps) so I'm
advocating for all the new module attributes default to the
currentModule context so we don't have to explicitly pass that value
in.
I now see your point Brett. Took me a while to realize what exactly it was, but I think I get it now. To recap,
The solution to this would be to default the module argument on renderview() and renderlayout() to the actual event.getCurrentModule() setting. If ran from a non module execution, then its ok, because it will be blank. But if you are within the module and you want to render something from the parent, then the module will have to be passed as EMPTY.
renderview(view=“myview”,module="")
This is the side-effect of having it set to default of the current module view. Does this make sense?
I'm running into an issue though with a LayoutsExternalLocation
specified. At first glance it appears renderer.locateModuleLayout()
explicitly returns the layout in the module without trying to resolve
the layout location. The issue appears to be in plugin/Renderer.cfc
lines 321-324.