No Code Attached Yet bug
avatar StefanSTS
StefanSTS
24 Nov 2022

Steps to reproduce the issue

How I got to the issue:

  1. Make a child template.
  2. Create an override for collapse-metismenu.php in html/mod_menu/.
  3. Switch to child template.

Expected result

The override for mod_menu should work like given in the child template.

Actual result

The override of the child template is not working.
You have to explicitely choose the child template override in the module.

System information (as much as possible)

PHP 8.0.x but doesn't matter I guess
J 4.2.5

Additional comments

If a template introduces a new layout file like collapse-metismenu.php, it should be automatically overridden by a child template.

The names in the layout setting for the different files in mod_menu settings, advanced tab is a bit confusing too:
Cassiopeia calls collapse-metismenu.php Collapsable Dropdown.
The child template uses the file name to generate the name to choose: collapse-metismenu.

It's all a bit inconsistent.

I guess it is intended by Joomla to use all child template files automatically.
So in advanced tab there might be a setting missing.

From cassiopeia/main template OR child -> missing
From module -> is there
From cassiopeia template -> is there
From cassiopeia_child -> is there

Default setting should be the one that I declared as missing. Kind of an automatic setting.
By default setting Joomla should take the template file/override or if available the child override file.

Template override available - no child override -> use template.
Template override available - child override available -> use child.
No template override - child override available -> use child.
No template override - No child override -> use base module.

The problem at the moment:
If someone would import a child template with various overrides, they would not work until every module is set to use the child template.
I got aware of this problem by someone stating that the child template would not work.
So this automatic setting would lead to a lot less user frustration.

avatar StefanSTS StefanSTS - open - 24 Nov 2022
avatar StefanSTS StefanSTS - change - 24 Nov 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 24 Nov 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Nov 2022
avatar dgrammatiko
dgrammatiko - comment - 24 Nov 2022

Switch to child template.

How exactly did you did that part? Just by enabling the child as the default template? If so check that ALL the menus are also using the child template as the default. Enabling just a child as default template WILL NOT (by design) assign ALL menus to that template!

avatar StefanSTS
StefanSTS - comment - 24 Nov 2022

I just enabled the child template and was expecting that all the overrides in the child template would work.
It's a child template with basically just the mod_menu override.
I just changed navbar navbar-expand-md to navbar navbar-expand-lg.

avatar dgrammatiko
dgrammatiko - comment - 24 Nov 2022

It's a child template with basically just the mod_menu override.

I think you're not getting what I'm trying to explain: the enable child as default template is not the same as assigning all the menus to the child template. Give it a try...

avatar StefanSTS
StefanSTS - comment - 24 Nov 2022

I don't want to assign menus to the child template. The menus should be assigned to the parent template. I just want to add a different layout to a module. The parent should do the work, the child should change the layout.

avatar richard67
richard67 - comment - 24 Nov 2022

I don't want to assign menus to the child template. The menus should be assigned to the parent template. I just want to add a different layout to a module. The parent should do the work, the child should change the layout.

@StefanSTS This is not how it works. Your expectation is wrong.

avatar StefanSTS
StefanSTS - comment - 24 Nov 2022

Maybe the system is too limited.
I would expect everything not set on the child to be inherited from the parent.
Saying my expectation is wrong expresses not too much motivation to think further.
A simple automation of the inheritance could make the system so much simpler to use. Like in other Joomla template systems that use this for the last ten years.

avatar brianteeman
brianteeman - comment - 24 Nov 2022

Can you clairfy please. Are you saying that you have set the default site template style to be the child template and the module override is not working?

avatar richard67
richard67 - comment - 24 Nov 2022

Well, if that is the case, then it is indeed a bug, and I misunderstood. If not and the expected behavior makes sense, it would be a feature request. Anyway it could be that our documentation is not really complete.

avatar StefanSTS
StefanSTS - comment - 24 Nov 2022

I have set the default site template style to be the child template and the module override for com_menu collapse-metismenu.php is not working.
Only if I set the module layout explicitely to the child template it works.
It might have to do with the fact that Cassiopeia introduces collapse-metismenu.php which is not present in core mod_menu.

avatar brianteeman
brianteeman - comment - 24 Nov 2022

ah got it - I understand what is happening now and why it is the expected behaviour

You have a module and it is set to use the cassiopeia module override/

You now create a child template and create a new override of the module

You set the child template as default

You expected the module that had been explicitly set to use a specific layout to magically change without you doing anything and to use a different layout in the child template.

If I have described everything correctly then it is not only expected behaviour but also the intended and desired behaviour.

avatar StefanSTS
StefanSTS - comment - 24 Nov 2022

You expected the module that had been explicitly set to use a specific layout to magically change without you doing anything and to use a different layout in the child template.

Yes, I thought it would magically use
child template's collapse-metismenu.php
over
parent template's collapse-metismenu.php.

In the same way as it magically changes when I make an override in Cassiopeia for mod_login/default.php.
If I enable Cassiopeia it shows me "Hello Parent".
If I enable Cassiopeia Child it shows me "Hello Child".
Got the child activated here: https://php80.sts-hosting.de/j4vm3/ without changing layout settings in the advanced tab.

If I have described everything correctly then it is not only expected behaviour but also the intended and desired behaviour.

It might look like it is the expected behaviour, but it's not consistent compared to the behaviour of default.php.
In case menu it does not override the parent.
In case login it does override the parent.
In both cases there is a set layout, once default(.php) From Module, once collapse-metismenu(.php) from Cassiopeia.
The problem is either,

  • you cannot set collapse-metismenu From Module. Because it is not present in core. Or
  • you cannot give it the same behaviour like you can give for default.php.
    So there is a setting missing, that a layout other than default.php can have the same behaviour as default.php.

I send this now and read it again to understand myself.

avatar StefanSTS
StefanSTS - comment - 24 Nov 2022

Tested another theory:
Added collapse-metismenu.php to the core module.
Used navbar-expand-sm.
Cassiopeia has navbar-expand-md.
Cassiopeia Child has navbar navbar-expand-lg.

Frontend shows -lg -> Showing the child template.

Setting in the module is set "explicitly" to From Module - collapse-metismenu.

This supports my theory that it only works when there is the same layout in the core module, because there you can explicitly set it to From Module, BUT explicitly or not, it uses Cassiopeia -> Cassiopeia Child.

Following this logic, I still expect that if the file is not in core, but I explicitly set the layout in Cassiopeia, it will be overridden by the child.

avatar dgrammatiko
dgrammatiko - comment - 24 Nov 2022

@StefanSTS check if #39308 is what you are after.

@brianteeman @richard67 probably this change makes sense if the parent is the same as the defined specific override, maybe not. Anyways if this is something you're interested the same logic needs to be applied in 2 more files

avatar richard67
richard67 - comment - 25 Nov 2022

Well, I don’t want to make decisions. If it works and people like it and it gets tested, then ok for me.

avatar richard67
richard67 - comment - 25 Nov 2022

@dgrammatiko You mentioned two more places to be changed. So does it need to keep this issue open, and your PR solves only one part of it? Or is your PR ready and complete and we can close this issue lok. we usually do when having a PR?

avatar dgrammatiko
dgrammatiko - comment - 25 Nov 2022

You mentioned two more places to be changed.

The layout part is similar for modules/plugins and components, so naturally if one is changed the other 2 need to be adjusted for consistency. The files/methods are:

public static function getLayoutPath($type, $name, $layout = 'default')

public function loadTemplate($tpl = null)

I think the issue should be closed when either a decision to adapt or not is made from the maintainers. FWIW I think the change asked here is reasonable...

avatar richard67
richard67 - comment - 25 Nov 2022

I‘ll ask the team for a decision.

avatar richard67
richard67 - comment - 25 Nov 2022

… Or at least for more opinions.

avatar wojtekxtx
wojtekxtx - comment - 25 Nov 2022

… Or at least for more opinions.

@richard67 Im not on the team, but you wanted opinion, so here you go:

IF template set (in ACP) as default template site-wide doesnt respect its child-overwrites than clearly its a bug that needs triaging > fixing. Thats it.

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar martyharty
martyharty - comment - 3 Feb 2024

I experienced a similar bug with a default child template of Atum admin template and com_menus/item/edit.php

But in this case also the control panel/ homepage is opened with the parent Atum template instead of the default child.

Other menus work fine.


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

Add a Comment

Login with GitHub to post a comment