I have the following field in my module's XML:
<field
addfieldpath="/modules/mod_xxxxxx/fields"
name="icon"
type="filelist"
label="Icon"
/>
To override this form field in Joomla 3, I would copy:
libraries/joomla/form/fields/filelist.php
to:
/modules/mod_xxxxxx/fields/filelist.php
and make whatever changes I like to the file.
This however, does not work in Joomla 4. The file doesn't even seem to be detected.
According to the Potential backward compatibility issues in Joomla 4, it states:
The libraries/joomla/form/fields and libraries/joomla/form/rules directories are no longer registered to find form classes, all form classes should be autoloaded instead.
But it provides no documentation on how to do so.
Does anyone know how to override a form field in Joomla 4?