That class should be added to the rendered code for that module.
The class is not added. Looking at mod_custom.php, the class is no longer grabbed, and tmpl/default.php makes no attempt to add the class.
The module class seems to be removed from all the module templates, except mod_menu.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
That seems like a leap backward in functionality. You'd need to create a module position to add chrome for every instance of a module you used, and then add the chrome styling. I'm referring to the module css class, not the chrome. The Module Class field is also still available to be added, but it currently being ignored. If I'm missing something on how classes entered into that field are rendered now in J4, please let me know.
A module position isn't 100% necessary, the Module Style field contains a list of all available chromes, and that choice will override what a layout position has set by default.
That still means that a chrome style must be set instead of a css class. It also doesn't address that the Module Class field is ignored.
That still means that a chrome style must be set instead of a css class.
As well not instead
It also doesn't address that the Module Class field is ignored.
Only if the chrome doesnt support the module class
That seems like a leap backward in functionality.
Nothing has really changed
That seems like a leap backward in functionality.
Nothing has really changed
Code from J4 mod_custom/tmpl/default.php:
<div id="<?php echo $modId; ?>" class="mod-custom custom">
Code from J3 mod_custom.tmpl/default.php:
<div class="custom<?php echo $moduleclass_sfx; ?>" ... >
That is a difference in how css classes get added. I see that chromes can use the class, just as I can use the class by adding back the code in the override, but that's adding work and complexity to get back to proper default. If a value is entered into a default field it should be used by default, especially something as basic and often used as a css class.
I think the custom module was changed to work in the same way as other modules too. You can have a look at mod_articles_latest or mod_articles_category or mod_login, no one of them have the module class in the view. If you have the module class in the view of mod_custom and you are also using a chrome like html5 (core) or card (Cassiopeia), you will end having the class twice in the code and that can cause problems depending on the CSS definitions, e.g. padding will be double.
In J3 all the other modules have the module class added to the module wrapping div. It changed for all in J4. It still makes more sense to me that the module class should be applied to the module wrapping div, not anything inside of it. No duplication would occur.
In J3, often the module as well as the chrome did apply the module class. This created various issues with styling and reliability.
Some modules didn't apply the class, and then also some templates didn't apply it in their chrome.
With J4, the responsibility is now clearly moved to the chromes, where they belong. Which is a very good thing.
Thanks @drmenzelit . I see it's a [barely] ongoing discussion about what to include as the default. I agree with https://github.com/joomla/joomla-cms/issues/34207#issuecomment-847967539
this bug still exist in the latest Joomla 4.2.2
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-09-16 06:42:01 |
Closed_By | ⇒ | drmenzelit |
In J3, often the module as well as the chrome did apply the module class. This created various issues with styling and reliability. Some modules didn't apply the class, and then also some templates didn't apply it in their chrome.
With J4, the responsibility is now clearly moved to the chromes, where they belong. Which is a very good thing.
It is explained in the comments above how to get the class displayed in custom modules. It is not a bug, it is expected behavior, so we are closing the issue.
The layout chrome handles that stuff in Joomla 4, specifically the html5 and table layouts. I assume it was done to reduce repetition of classes.