I have the editors-xtd\vimeo
plugin with this structure
..\plugins\editors-xtd\vimeo\models\fields\(a bunch of custom fields)
..\plugins\editors-xtd\vimeo\forms\form.xml
..\plugins\editors-xtd\vimeo\forms\extra.xml
In both the .xml
files I used
<fieldset addfieldpath="/plugins/editors-xtd/vimeo/models/fields">
All working perfect in Joomla 3.9.5+ but I don't know how to set the addfieldprefix
in Joomla 4, already tried (according to the JAB presentation) to
<fieldset name="vimeo-options" addfieldprefix="Plugin\EditorsXtd\Vimeo">
In a previous question, I found out how to use com_ajax
to set a custom layout for the plugin, here is how I load the .xml
files in my layout
..\plugins\editors-xtd\vimeo\tmpl\default.php
via
Form::addFormPath(JPATH_ROOT.'/plugins/editors-xtd/vimeo/forms/');
$form = Form::getInstance('form',JPATH_ROOT.'/plugins/editors-xtd/vimeo/forms/form.xml');
$form->addFieldPath(JPATH_ROOT.'/plugins/editors-xtd/vimeo/models/fields/');
$form->loadFile('extra',false,false);
The pop-up content is empty, no fields loaded from extra.xml
.
Thanks for any input/suggestion.
$form = Form::getInstance('form',JPATH_ROOT.'/plugins/editors-xtd/vimeo/forms/form.xml');
but you want to loadextra.xml
, then the path is not correct.<fieldset name="vimeo-options" label="PLG_SOMETHING_SOMETHING" addfieldpath="plugins/editors-xtd/vimeo/models/fields">
- these two things I can see suddenly...addfieldpath="something"
oraddfieldprefix="something"
works.$form->addFieldPath(JPATH_ROOT.'/plugins/editors-xtd/vimeo/models/fields/');
and removedaddfieldpath
attribute for the fieldsets in the.xml
files, but I didn't actually see anything until I inspected the source. The form is there, just for some reason getting a value of some field via$form->getField('fieldName')
breaks everything.var_dump($form)
right after loading the.xml
files gets the form into the page.