Feature No Code Attached Yet
avatar Scrabble96
Scrabble96
28 Feb 2024

Is your feature request related to a problem? Please describe.

It's currently possible to:

  1. Add a class to a module, including the header, i.e. the whole 'card' if using Cassiopeia
  2. Add a class to a module header only, i.e. 'card-header'

but it is not possible to add a class to the module content/card-body only.

Describe the solution you'd like

In my case I wanted to add (for one module only, not all modules of that type in that position), assign it to the 'side-bar' left position and then add a class (a version of grid-child or some other code) to the body of 'three-cols' so that the list on medium screens would display in four then three then two columns depending on screen width:

mod-articles-category-with-four-cols

instead of one long single-column list with a large gap to the side:

mod-articles-category-without-three-cols

Or someone might want to apply a different background to that card body.

Yes, it could be done in user.css but would need to be done, I believe, for each individual module. Far easier to apply an existing class to whichever card requires it, particularly if the user creating the module doesn't have access to the template files.

So, in the module setup under the Advanced tab, as well as 'Module Class' and 'Header Class' there would be a 'Body Class' and the 'card' chrome would reflect this with additional code after line 29 along the lines of:

$bodyClass            = htmlspecialchars($params->get('body_class', ''), ENT_QUOTES, 'UTF-8');

and line 57 would change to something like:

    <div class="card-body <?php echo $bodyClass; ?>">

[with a space after 'card-body' so that the class is rendered correctly]

I expect other additions would be needed.

Additional context

avatar Scrabble96 Scrabble96 - open - 28 Feb 2024
avatar joomla-cms-bot joomla-cms-bot - change - 28 Feb 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 28 Feb 2024
avatar brianteeman
brianteeman - comment - 28 Feb 2024

Why not create your own chrome for this specific case?

avatar Scrabble96
Scrabble96 - comment - 28 Feb 2024

Yes, I can see that I can select a custom chrome from the 'Module Style' [shouldn't this be called 'Module Chrome'?] but:

say there's custom CSS for a corporate colour to be used as the background in certain cases e.g.

.custom-colour {
  background-color: #d8b5ff;
}

For whatever reason, a user might want to apply that corporate background colour to the card body of a selected custom module, a newsflash module or any other type of module in different positions. Unless I understand incorrectly, your suggestion means having to create a custom chrome for each potential position and layout, instead of just applying 'custom-colour' to my proposed bodyClass field for the module content/card body.

avatar Hackwar Hackwar - change - 26 Mar 2024
Labels Added: Feature
avatar Hackwar Hackwar - labeled - 26 Mar 2024
avatar rdeutz
rdeutz - comment - 11 Apr 2024

Module chrome defines how a module gets rendered you can find the existing in layouts/chromes. Moving the issue to discussions, doesn't seens to me something we need to implement.

avatar rdeutz rdeutz - change - 11 Apr 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-04-11 15:09:27
Closed_By rdeutz
avatar rdeutz rdeutz - close - 11 Apr 2024

Add a Comment

Login with GitHub to post a comment