[ENHANCEMENT]: Standard module does not have a modulelayout field #1248

Open
opened 2025-08-28 14:36:37 +00:00 by SimonvanDoorne · 2 comments
Member

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!

### 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!
SimonvanDoorne added the
enhancement
label 2025-08-28 14:36:37 +00:00
Owner

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.

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.
Author
Member

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"
			/>

afbeelding.png
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

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" /> ![afbeelding.png](/attachments/fc4823f6-8561-4b06-b99a-2f075abbb972) 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
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1248
No description provided.