User tests: Successful: Unsuccessful:
Form definitions in XML allow the usage of add(field|form|filter|rule)(path|prefix)
to add form fields, forms, filters and rules from specified paths. Right now, this only works for single values. This means, if you want to import fields from two different locations, you need to specify them for example like this:
<fields name="params" addfieldpath="path/to/first/fields">
<fieldset name="basic" addfieldpath="path/to/second/fields">
This separation of the two paths is not logically motivated. Second, it introduces a limitation on the number of paths you can add. If you have a structure form > fields > fieldset
, you can enter at most three paths. To add more, you'd have to introduce empty dummy fieldsets at the end of the file.
This PR introduces the possibility to add multiple paths in a single argument, separated by comma. This reduces the above example to:
<fields name="params">
<fieldset name="basic" addfieldpath="path/to/first/fields,path/to/second/fields">
addfieldpath
, addfieldprefix
, addfilterpath
, addfilterprefix
, addformpath
, addformprefix
, addrulepath
, and addruleprefix
still work as before.I wrote https://github.com/Harmageddon/plg_demo_addfieldpath and https://github.com/Harmageddon/plg_demo_addfieldprefix for testing. As they use cross-references between each other, both need to be installed at the same time.
This plugin aims to test the add*path functionalities. The form should contain the following fields:
addfieldpath
.addfieldpath
.addfilterpath
and addrulepath
.addfilterpath
and addrulepath
.addformpath
.This plugin aims to test the add*prefix functionalities. The form should contain the following fields:
addfieldprefix
.addfieldprefix
.addfilterprefix
and addruleprefix
.addfilterprefix
and addruleprefix
.I couldn't find any usage of addformprefix
, so if someone has an idea how to test this, I'm open for suggestions.
Could be noted at https://docs.joomla.org/Creating_a_custom_form_field_type#Linked_with_a_form or https://docs.joomla.org/Advanced_form_guide.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Oh, I see. Maybe a colon could work for Windows? But for POSIX, I can't find any reserved characters that can't be included in paths, except the null byte. But maybe we can assume that extension developers don't include colons in their folder structure?
You're right. Because of the documentation and the examples in core, I thought, these attributes needed to be in a form
or fieldset
tag. But every of these attributes can be added directly to the respective field tag. And I don't see any scenario where you would need more than one value for a single field. So I'm closing this here.
Thanks to @Bakual for pointing this out! :-)
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-11 16:35:08 |
Closed_By | ⇒ | Harmageddon |
A comma is a valid path character, we need another character for this that works on windows and posix filesystems.