I ran into a scenario where 2 JForm instances are on the same page. Each instance's XML used addfieldpath="/components/com_comp1/models/fields"
. Each field location had a JForm field called layout
which were completely unrelated. However, because the field paths are loaded statically, both instances will use the highest loaded layout
custom field.
addfieldpath=""
location to 2 separate places (e.g. component & plugin).Each JForm instance should have the field location specified in the XML.
Each JForm instance receives both path locations as they are set statically.
Joomla 3 with any environment & browser.
As there isn't any namespace ability like JLayout perhaps if there was a JForm::removefieldpath()
we could manually fix our conflicts but ideally if an XML instance has a addfieldpath=""
present, this shouldn't load into other instances of JForm should it?.
Thoughts welcome :)
Labels |
Added:
?
|
No way! I actually have JForm
& JField's
classes permanently open for reference & I still missed that feature!
I agree, namespacing is a much better solution than post removal logic. Thanks for pointing that out.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-07-04 08:31:43 |
Closed_By | ⇒ | bassmanpaul |
For me part of the problem is in the fact that there is very little documentation or actual demonstrated use of JForm's namespacing ability to convert a field type to a class name. A couple of examples:
type="text"
results in a class name ofJFormFieldText
type="my.text
results in a class name ofMyFormFieldText
The stats plugin actually does use namespacing for fields.
You could probably fix your own code by namespacing stuff but you can't really deal with third party uses which may or may not do the same and create the same potential issues down the line.
I'm personally not a fan of "remove lookup instruction" methods like your suggested
removeFieldPath()
method. Especially since all of these methods (i.e. in the MVC layer, JTable, JHtml, and JForm) are all static and global versus per instance so such a removal has more potential to break stuff than not.