No Code Attached Yet
avatar mtechoh
mtechoh
4 Feb 2022

Steps to reproduce the issue

  1. Create an instance of mod_custom (or several mod_* content modules).
  2. Enter any value into Advanced > Module Class, save, check front end.

Expected result

That class should be added to the rendered code for that module.

Actual result

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.

System information (as much as possible)

Additional comments

The module class seems to be removed from all the module templates, except mod_menu.

avatar mtechoh mtechoh - open - 4 Feb 2022
avatar mtechoh mtechoh - change - 4 Feb 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 4 Feb 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 4 Feb 2022
avatar Chaosxmk
Chaosxmk - comment - 4 Feb 2022

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.

avatar mtechoh
mtechoh - comment - 4 Feb 2022

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.

avatar Chaosxmk
Chaosxmk - comment - 4 Feb 2022

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.

avatar mtechoh
mtechoh - comment - 4 Feb 2022

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.

avatar brianteeman
brianteeman - comment - 5 Feb 2022

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

avatar mtechoh
mtechoh - comment - 5 Feb 2022

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.

avatar drmenzelit
drmenzelit - comment - 7 Feb 2022

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.

avatar mtechoh
mtechoh - comment - 7 Feb 2022

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.

avatar drmenzelit
drmenzelit - comment - 7 Feb 2022

That was the PR changing that
#17447

avatar Bakual
Bakual - comment - 7 Feb 2022

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.

avatar mtechoh
mtechoh - comment - 7 Feb 2022

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

avatar benjokoren
benjokoren - comment - 15 Sep 2022

this bug still exist in the latest Joomla 4.2.2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/36942.

avatar drmenzelit drmenzelit - change - 16 Sep 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-09-16 06:42:01
Closed_By drmenzelit
avatar drmenzelit drmenzelit - close - 16 Sep 2022
avatar drmenzelit
drmenzelit - comment - 16 Sep 2022

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.

Add a Comment

Login with GitHub to post a comment