If I want to add a Subform to my Module I need to specify the "formsource" (path to xml) into my fieldsettings. But is there a way to use The Autoloader and "simply" use the Form name? In the docs it's written "[...]formsource (mandatory) the form source to be included. A relative path to the xml file (relative to the root folder for the installed Joomla site) or a valid form name which can be found by JForm::getInstance()..." So my question now is - is there a way to use the name here also in modules now?
So when using the new Filestructure for Modules I think i need to register the namespace for Forms (and Fields) in my provider.php, and if so how to do this ?
My current provider.php:
return new class() implements ServiceProviderInterface
{
public function register(Container $container): void
{
$container->registerServiceProvider( new ModuleDispatcherFactory('\\CMP\\Module\\Modulename'));
$container->registerServiceProvider( new HelperFactory('\\CMP\\Module\\Modulename\\Site\\Helper'));
$container->registerServiceProvider( new Module());
}
};
File Structure:
mod_modulename
- forms
-- subform.xml
...
- services
-- provider.php
- src
-- Dispatcher
- mod_modulename.xml
...
mod_modulename.xml:
...
<field
name="title_source_params"
type="subform"
formsource="modules.mod_modulename.subform"
/>
...
Error:
Joomla\CMS\Form\Form::getInstance() could not load file
Again, I know i could simply paste in the path to the xml in the formsource but does it work / what do I need to do to use the formname instead?