No Code Attached Yet bug
avatar ramalama
ramalama
23 Mar 2026

What happened?

  1. In my plugin I have a Model that extends com_content/CategoryModel which builds on AdminModel and FormModel.
  2. When I call in my getForm() the $this->loadForm('componentName.category', category) everything works as expected.
  3. When I call $this->loadForm('componentName.category', 'category_some_specific_variant') I don't get the fields from category_some_specific_variant.xml but the ones from category.xml
  4. Digging deeper revealed Form->loadForm() from the FormBehaviorTrait calls $this->preprocessForm.
  5. The preprocessForm from com_content/CategoryModel calls $form->load($addform, false)
  6. The Implementation of Form->load() is supposed to remove a field from the data if it is already present in the form and $replace == false.
  7. Line 659 unset($field); is wrong for SimpleXMLElement, this only removes the local variable without removing the Element from the data tree.
  8. According to https://www.w3docs.com/snippets/php/remove-a-child-with-a-specific-attribute-in-simplexml-for-php.html correct removal code would be unset($field[0]);

Version

6.0

Expected result

both xml files category.xml and category_some_specific_variant.xml exist and
I call $result = $this->loadForm('componentName.category', 'category_some_specific_variant')
I expect $result->getXML to contain only one fieldset with correct overwriting, with category_some_specific_variant.xml taking precedence over category.xml

Image

Actual result

Image

System Information

Joomla! 6.0.3 Stable [ Kuimarisha ] 17-February-2026 16:00 UTC
PHP 8.3.16

Additional Comments

The issue applies to all current Joomla Versions afaik

avatar ramalama ramalama - open - 23 Mar 2026
avatar joomla-cms-bot joomla-cms-bot - change - 23 Mar 2026
Labels Added: No Code Attached Yet bug
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Mar 2026
avatar Fedik
Fedik - comment - 23 Mar 2026

It is expected behavior, it is how the Form class work.

avatar Fedik
Fedik - comment - 23 Mar 2026

Hm, or maybe not :)

avatar Harshita-kothari
Harshita-kothari - comment - 29 Mar 2026

Hi 👋

I am Harshita, a GSoC 2026 applicant working on the Multicategory Support project.

I am currently exploring how categories are handled in Joomla and came across this issue. I would like to understand more about how category selection is implemented and what challenges exist in extending it.

Any guidance would be really helpful. Thanks!

avatar ramalama
ramalama - comment - 29 Mar 2026

Hi 👋

I am Harshita, a GSoC 2026 applicant working on the Multicategory Support project.

I am currently exploring how categories are handled in Joomla and came across this issue. I would like to understand more about how category selection is implemented and what challenges exist in extending it.

Any guidance would be really helpful. Thanks!

Hi @Harshita-kothari
this issue is not connected to the joomla category system. Its an issue with how the xml forms are loaded. So this issue doesnt match the topic you are looking for.

Add a Comment

Login with GitHub to post a comment