Testing my Joomla 3.9 extensions in Joomla 4, some of them didn't work, because, as instructed with the (probably) old documentation my custom fields use

require_once JPATH_ROOT . '/libraries/joomla/form/fields/list.php';

and they don't work, so this results in

Warning: require_once(mysite/libraries/joomla/form/fields/list.php): 
failed to open stream: No such file or directory in 
site\plugins\editors-xtd\vimeo\models\fields\customField.php on line 5

Fatal error: require_once(): Failed opening required 'site/libraries/joomla/form/fields/list.php' in site\plugins\editors-xtd\vimeo\models\fields\customField.php on line 5

This means I have to use namespaces, and after some investigation into core Joomla fields, here's what I came up with

//require_once JPATH_ROOT . '/libraries/joomla/form/fields/list.php';

use Joomla\CMS\Form\FormField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Field\ListField;

// FormHelper::loadFieldClass('Joomla\CMS\Form\Field\ListField'); // also tried

class FormFieldCustomField extends ListField {

  protected $type = 'CustomField';
  // methods and stuff

This makes it that instead of my field being rendered properly, I get a text field, strangely enough, it also loads the JS/CSS assets. My getInput() method process the form values without using a layout, perhaps that's the issue in this case, but I don't actually know.

Thanks for any reply.

  • Could you try using FormHelper::loadFieldClass('list'); instead and see what happens?
    – Lodder
    Commented May 18, 2019 at 11:57
  • @Lodder the same. Just a simple text field there.
    – thednp
    Commented May 18, 2019 at 12:00
  • use Joomla\CMS\Form\Field\ListField; is the correct way to import field class. It's your field that's not found. Namespaced class need to adhere to naming conventions and folder structure. Your field does not. It's also unclear how you're trying to load the field class in the form. Have you made any changes since your previous question?
    – Sharky
    Commented May 18, 2019 at 13:07
  • I use the same way as described in my answer here, and as for how the field is called into the form, I explained here.
    – thednp
    Commented May 18, 2019 at 13:15
  • @thednp - You’re jumping a bit from one subject to another. First thing first. 1. Load a form properly into a layout. Any simple form. It’s really not that hard. 2. Create a custom form field properly. Then put the two together and it’s done.
    – Zollie
    Commented May 18, 2019 at 14:01

1 Answer 1


I figured what the problem is. The naming scheme with Joomla 4 is different not only by the missing J but also word order. Also folder structure and other classes deprecated/changed.

In this very example FormFieldCustomField should be CustomFieldField if I were to manage to register the namespace (I'm totally new to this stuff), instead I better use this JFormFieldCustomField extends JFormFieldList and it works just fine, probably until Joomla 5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.