Is Joomla 4 still in Beta and should we develop components for it??

Skip to first unread message

Oct 9, 2021, 2:16:44 AM10/9/21
to Joomla! General Development
I was playing around a bit with Joomla 4 as I heard it was out of the beta stage and is now the preferred installation.

It seemed all good until I decided to follow the "Hello World!" MVC component tutorial and there was a warning at the beginning that Joomla 4 is still in Beta and some bits of this aren't completed yet.

Ok so I started following the MVC tutorial and it was all going well until I got to the most important bit - Database integration.  

At this point it shows how to create a new table in the database (pretty much the same as Joomla 3 anyway) and then the next article goes onto how to create the back end, etc...

However this is where the tutorial stopped.  Really annoying as I was starting to fully understand how Joomla MVC components are made (in the past I've always skipped over creating MVC components and pretty much butchered K2 templates to get that to do what I wanted it to do using the custom fields - but I noticed K2 isn't on J4 yet and also I feel kind of cheating to use the custom fields in a template rather than creating a proper MVC component).

I've had a look into the code of some of the components like com_banners and com_phocagallery to see if I can figure out how they create their own back end and tried to create my own custom field but it just doesn't seem to do anything.  In fact it just seems to use a text box for my custom field so I guess it's not using my custom field code.  

Here is an example of some of the code I was trying...



defined('JPATH_BASE') or die;

use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;


class JFormFieldMyList extends ListField

    public $type = 'mylist';
    protected function getOptions ()
        echo '<p>getOptions</p>' ;
        return array ( 'Hello', 'Goodbye' ) ;

    protected function getInput()
        echo '<p>getInput</p>' ;
        return parent::getInput();

and in site\tmpl\podcast\default.xml 

<?xml version="1.0" encoding="utf-8"?>
    <fields name="request">
        <fieldset name="request" addfieldpath="/administrator/components/com_podcasts/models/fields">
            <field  name="id"

I know I must be missing something here - I thought with this code as getOptions is returning an array of "Hello", "Goodbye" I would end up with a dropdown list when editing the menu item of hello/goodbye but it doesn't even seem to loading the field definition as I added two echo commands so could see if it was running any part of the script - but nothing.

Without the MVC tutorial being finished though it's hard to see where I'm actually going wrong.

Thanks for any help and advice on where I'm going wrong (or even an actual link to a tutorial).

Oct 9, 2021, 2:33:19 AM10/9/21
to Joomla! General Development
Ok so after much puzzling around over why on earth I couldn't get the field to work... I figured it out...  omg how stupid of me not to think of that one!!!

There was nothing wrong with any of the above..  in the component xml file there was one simple bit I'd omitted - in the <files folder="admin"> section I'd forgot to add
<folder>models</folder> - no wonder it couldn't run the field code as it wasn't installed!!


I've now got a working custom field :D :D - at least that's a start!

Reply all
Reply to author
0 new messages