User tests: Successful: Unsuccessful:
Pull Request resolves #47488 .
Summary of Changes
This PR resolves an issue where alternative layouts ( template overrides ) ignored the 'option' and 'title' attributes in their XML files, displaying only the filename (e.g "alt') in the dropdown. This fix brings consistency between core component layouts and template overrides.
Testing Instructions
1.Create a template override for Category Blog in your active template:
path:
templates/[your_template]/html/com_content/category/alt.php
path:
templates/[your_template]/html/com_content/category/alt.php
2.Edit alt.xml and set:
<layout title="MY_TITLE" option="MY_OPTION_TEXT">.
3.Go to Articles>options>Category tab.
4.Open the "Choose a Layout" dropdown
Actual result BEFORE applying this Pull Request
The dropdown item for the template overide shows only the filename: "alt".
Expected result AFTER applying this Pull Request
The dropdown item correctly displays the translated text or string from the XML attribute:"MY_OPTION_TEXT".
Screenshot
Link to documentations
Please select:
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Labels |
Added:
PR-5.4-dev
|
||
| Title |
|
||||||
I have tested this item ✅ successfully on bb280cd
I have tested this item ✅ successfully on bb280cd
I have tested this item ✅ successfully on bb280cd
Tested successful - the Option is shown in the drop down list. BUT
When using invalid xml I have 3x this error over the screen:
I have Warning: simplexml_load_file(): /joomla/testabc/templates/cassiopeia/html/com_content/article/alternatelayout.xml:9: parser error : Premature end of data in tag metadata line 2 in /Users/elisa/Development/joomla/testabc/libraries/src/Form/Field/ComponentlayoutField.php on line 216
Before applying the patch there was no such warning for the invalid xml. Maybe there is a need to catch this case?
I have tested this item ✅ successfully on bb280cd
Tested successful - the Option is shown in the drop down list. BUT
When using invalid xml I have 3x this error over the screen:
I have Warning: simplexml_load_file(): /joomla/testabc/templates/cassiopeia/html/com_content/article/alternatelayout.xml:9: parser error : Premature end of data in tag metadata line 2 in /Users/elisa/Development/joomla/testabc/libraries/src/Form/Field/ComponentlayoutField.php on line 216
Before applying the patch there was no such warning for the invalid xml. Maybe there is a need to catch this case?
I have tested this item ✅ successfully on bb280cd
Tested successful - the Option is shown in the drop down list. BUT
When using invalid xml I have 3x this error over the screen:
I have Warning: simplexml_load_file(): /joomla/testabc/templates/cassiopeia/html/com_content/article/alternatelayout.xml:9: parser error : Premature end of data in tag metadata line 2 in /joomla/testabc/libraries/src/Form/Field/ComponentlayoutField.php on line 216
Before applying the patch there was no such warning for the invalid xml. Maybe there is a need to catch this case?
| Labels |
Added:
Updates Requested
PBF
|
||
| Labels |
Added:
bug
Removed: Updates Requested PBF |
||
@Divya3215 I've allowed myself to apply some code style fixes to your PR.
I've restored the previous human tests in the issue tracker as the later commits which have invalidated the tests were just code style changes, so the tests are still valid.
| Status | Pending | ⇒ | Ready to Commit |
RTC
RTC
| Labels |
Added:
RTC
|
||
When using invalid xml I have 3x this error over the screen: I have Warning: simplexml_load_file(): /joomla/testabc/templates/cassiopeia/html/com_content/article/alternatelayout.xml:9: parser error : Premature end of data in tag metadata line 2 in /joomla/testabc/libraries/src/Form/Field/ComponentlayoutField.php on line 216
Before applying the patch there was no such warning for the invalid xml. Maybe there is a need to catch this case?
@coolcat-creations First, thank you for testing 👍 For your finding, I would consider this a valid and clear error message for an invalid XML file, isnt it? Overrides can be dangerous! 😱 While testing for me, if the override is really working, I got 500 Layout alt_item not found and learned that I also had to copy blog_item.php as alt_item.php. Therefore, I don't think we have to (and can) catch and suppress all configuration errors.
Final test before merge with JBT on 5.4.9-dev and using MariaDB
mkdir -p templates/cassiopeia_child/html/com_content/category for f in .php .xml _item.php _links.php _children.php; do
cp components/com_content/tmpl/category/blog$f templates/cassiopeia_child/html/com_content/category/alt$f
done
alt.xml file as 'Alternative Blog'echo line in alt.php file to mark the alternative layoutaltgh pr checkout 47495
administrator/language/overrides/en-GB.override.ini withCOM_CONTENT_CATEGORY_VIEW_ALT_TITLE="Alternative Blog Title"
COM_CONTENT_CATEGORY_VIEW_ALT_OPTION="Alternative Blog Option"
de-DE language and created corresponding overwriteCategory Blog menu item type
administrator/logs files| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-08-25 16:31:15 |
| Closed_By | ⇒ | muhme |
Thank you very much @Divya3215 for your contribution. Thanks to @QuyTon and @richard67 for your support. Thanks to @rvbgnu, @rbuelund and @coolcat-creations for testing.
on a Test site for PBF, I run into another issue: