There is currently no option for selecting a template. I understand that JCB only creates a single view and so a selector isn't needed. The only problem is when we install a module on different sites with different templates we need 2 different versions since we can't make an override and select it. The "modulelayout" field does exactly what i want, which only needs a little styling (which i could do if that would quicken adding it).
Which part of the extension will be affected by this enhancement?
Compilation of component, Joomla Modules(admin_views), Joomla Module(admin_view)
Additional Context
After compiling a module, you cannot select different layout in the module. A usecase for why i'm asking for this to be added:
We have a form component where we have a custom form builder for a client. They need some specific logic that is difficult to add with regular form components like chronoforms or rsforms. Currently the client has 2 sites, with different versions of Joomla, and different templates. One uses bootstrap and the other using UIKit. This has no clean solution since we either need 2 modules (creates issues with having to update 2 versions) or we have 1 view with 2 complete views in it, 1 for each template. Apart from this single client we want to implement our form builder on other sites since we're moving away from standard form generators since they often create issues with upgrading Joomla versions. An issue JCB neatly solves!
### Enhancement Details
There is currently no option for selecting a template. I understand that JCB only creates a single view and so a selector isn't needed. The only problem is when we install a module on different sites with different templates we need 2 different versions since we can't make an override and select it. The "modulelayout" field does exactly what i want, which only needs a little styling (which i could do if that would quicken adding it).
### Which part of the extension will be affected by this enhancement?
Compilation of component, Joomla Modules(admin_views), Joomla Module(admin_view)
### Additional Context
After compiling a module, you cannot select different layout in the module. A usecase for why i'm asking for this to be added:
We have a form component where we have a custom form builder for a client. They need some specific logic that is difficult to add with regular form components like chronoforms or rsforms. Currently the client has 2 sites, with different versions of Joomla, and different templates. One uses bootstrap and the other using UIKit. This has no clean solution since we either need 2 modules (creates issues with having to update 2 versions) or we have 1 view with 2 complete views in it, 1 for each template. Apart from this single client we want to implement our form builder on other sites since we're moving away from standard form generators since they often create issues with upgrading Joomla versions. An issue JCB neatly solves!
This is done in libraries/src/Dispatcher/AbstractModuleDispatcher.php
The module mod_login uses the modulelayout field.
In the xml:
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
class="form-select"
validate="moduleLayout"
/>

The 'old' J3 modules that come with base joomla still calls the layout like this:
```
$layout = $params->get('layout', 'default');
// Logged users must load the logout sublayout
if (!$user->guest) {
$layout .= '_logout';
}
require ModuleHelper::getLayoutPath('mod_login', $layout);
```
While the mod_custom uses the dispatcher, which funny enough still ends up calling the same logic:
`require ModuleHelper::getLayoutPath($module->module, $params->get('layout', 'default'));`
This is done in libraries/src/Dispatcher/AbstractModuleDispatcher.php
You will see the new architecture towards Joomla 5 native... please test it a little, and let me know. I am sure we can add this option to the modules.
So if you build a module and add the extra xml to the module manually, does it work. This will help me, since I am working on other parts in JCB at this time, and you ironing out this will help.
We have now added the new Module builder in https://github.com/joomengine/pkg-component-builder/archive/refs/heads/5.x.zip
You will see the new architecture towards Joomla 5 native... please test it a little, and let me know. I am sure we can add this option to the modules.
So if you build a module and add the extra xml to the module *manually*, does it work. This will help me, since I am working on other parts in JCB at this time, and you ironing out this will help.
So far it seems to work like charm! I created a new component and a new module with the version you linked. Added the field like i described in my first comment.
Adding the layout field it auto detects all views in the module tmpl folder and from the template overrides.
Selecting the different views loads the correct php file. Havent had time yet to fully test any edge cases but so far it looks good!
So far it seems to work like charm! I created a new component and a new module with the version you linked. Added the field like i described in my first comment.

Adding the layout field it auto detects all views in the module tmpl folder and from the template overrides.
Selecting the different views loads the correct php file. Havent had time yet to fully test any edge cases but so far it looks good!
$data['user']=$data['app']->getIdentity();$data['layout']=$data['params']->get('layout','default');// Logged users must load the logout sublayout
if(!$data['user']->guest){$data['layout'].='_your_custom_layout_in_jcb_logout';$data['params']->set('layout',$data['layout']);// to load the template
// $this->loadTemplate('your_custom_layout_in_jcb_logout');
// you can link multiple templates to a module
// $this->loadTemplate('other_template');
// $this->loadTemplate('yet_another_template');
}
But we have also added the extra xml details to the module 👍 in v5.1.2-beta3 (will be out later today)
Just as a side note, you can/could actually add your own advance fields to your module, which will then stop JCB from loading it, and cause it to be loaded as per your field settings. So not adding a config->params->advance field set, JCB will now add it for you.
This way:
This location in the code tab of a module:

The code:
```php
$data['user'] = $data['app']->getIdentity();
$data['layout'] = $data['params']->get('layout', 'default');
// Logged users must load the logout sublayout
if (!$data['user']->guest)
{
$data['layout'] .= '_your_custom_layout_in_jcb_logout';
$data['params']->set('layout', $data['layout']);
// to load the template
// $this->loadTemplate('your_custom_layout_in_jcb_logout');
// you can link multiple templates to a module
// $this->loadTemplate('other_template');
// $this->loadTemplate('yet_another_template');
}
```
**But we have also added** the extra xml details to the module 👍 in **v5.1.2-beta3** (will be out later today)
Just as a side note, you can/could actually add your own advance fields to your module, which will then stop JCB from loading it, and cause it to be loaded as per your field settings. So not adding a `config->params->advance` field set, JCB will now add it for you.
This way:

Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Enhancement Details
There is currently no option for selecting a template. I understand that JCB only creates a single view and so a selector isn't needed. The only problem is when we install a module on different sites with different templates we need 2 different versions since we can't make an override and select it. The "modulelayout" field does exactly what i want, which only needs a little styling (which i could do if that would quicken adding it).
Which part of the extension will be affected by this enhancement?
Compilation of component, Joomla Modules(admin_views), Joomla Module(admin_view)
Additional Context
After compiling a module, you cannot select different layout in the module. A usecase for why i'm asking for this to be added:
We have a form component where we have a custom form builder for a client. They need some specific logic that is difficult to add with regular form components like chronoforms or rsforms. Currently the client has 2 sites, with different versions of Joomla, and different templates. One uses bootstrap and the other using UIKit. This has no clean solution since we either need 2 modules (creates issues with having to update 2 versions) or we have 1 view with 2 complete views in it, 1 for each template. Apart from this single client we want to implement our form builder on other sites since we're moving away from standard form generators since they often create issues with upgrading Joomla versions. An issue JCB neatly solves!
This sounds like a great idea... give me a module. Basic one, that has this feature coded into it, and I will see what we can do.
The module mod_login uses the modulelayout field.
In the xml:
The 'old' J3 modules that come with base joomla still calls the layout like this:
While the mod_custom uses the dispatcher, which funny enough still ends up calling the same logic:
require ModuleHelper::getLayoutPath($module->module, $params->get('layout', 'default'));This is done in libraries/src/Dispatcher/AbstractModuleDispatcher.php
We have now added the new Module builder in https://github.com/joomengine/pkg-component-builder/archive/refs/heads/5.x.zip
You will see the new architecture towards Joomla 5 native... please test it a little, and let me know. I am sure we can add this option to the modules.
So if you build a module and add the extra xml to the module manually, does it work. This will help me, since I am working on other parts in JCB at this time, and you ironing out this will help.
So far it seems to work like charm! I created a new component and a new module with the version you linked. Added the field like i described in my first comment.

Adding the layout field it auto detects all views in the module tmpl folder and from the template overrides.
Selecting the different views loads the correct php file. Havent had time yet to fully test any edge cases but so far it looks good!
This location in the code tab of a module:

The code:
But we have also added the extra xml details to the module 👍 in v5.1.2-beta3 (will be out later today)
Just as a side note, you can/could actually add your own advance fields to your module, which will then stop JCB from loading it, and cause it to be loaded as per your field settings. So not adding a
config->params->advancefield set, JCB will now add it for you.This way:

Tested this by making a module and the layout field works exactly like expected! Thank you implenting this so quickly!