joomla/joomla-cms

Alternative Layout

Closed this issue ยท 8 comments

Steps to reproduce the issue

I have an alternative layout for com_content view article in protostar. Up to now I had the files default2.php and default2_links.php.
As I want to use this layout in a menu type, I created the file default2.xml

Expected result

I see this alternative layout when I create an article and I see this alternative layout in the options of com_content for selecting it as global for all articles.

Actual result

Before I created the default2.xml I saw the alternativ layout in the options of com_content for selection it as global. After creating the file defautl2.xml I do not see it any more in the options of com_content. I only see it, when I create a menu item.

@astridx is this still a valid issue?

@franz-wohlkoenig
Yes, I just tested it with Joomla! 3.8.0-beta5-dev

@astridx thanks for Update. Hopefully a Dev. come around.

I can confirm and reproduce this.

According to this comment, it is actually intended behavior. But don't ask me why.
https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/form/field/componentlayout.php#L182-L183

The code which actually removes them from the list is a few lines later: https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/form/field/componentlayout.php#L195

The issue which introduced that code was https://developer.joomla.org/joomlacode-archive/issue-23054.html

b. Alternative menu items will be required to have XML files. So, any XML files and matching php files will be assumed to be alternative menu items. They will show on the menu item list but NOT on the alternative layout list.

Wow, that's some nice research you did there, great finds.
However, no idea why either, I do not see the reason why the two things (alternative menu items and alternative article layout) can't coexist. Just the fact that it's an alternative menu item doesn't necessarily mean you will never need to use it for an individual article that doesn't have a menu item.
Maybe we should address that. ๐Ÿ˜„

I think we should explain it at least in a comment. The comment could be in the description of the alternative layout selection field. We have discovered this in our Joomla! User Group the first time and we were all convinced that it is a bug.

Please test #18159