Joomla 4 Custom Fields - Extend Joomla To Next Level
- by Naveen Kumar
- on Tutorials
Joomla 4 is around the corner so all you Joomla lovers must be trying to get their hands set on this new version of the CMS. Some I hear are already trying to migrate their sites to Joomla 4 even, but hold on guys it’s just the beta version. There is much more to the new Joomla 4 than just its design, the interface, the new media manager, or the improved SEO options. Joomla 4 now has even better and improved Custom fields too.
Custom fields were introduced in Joomla 3.7 that allows its users to add more and more information in its articles, user groups, and contacts that can also be seen on the frontend. Keeping forward this amazing feature, Joomla 4 has now re-introduced them in a more improved manner such that users now will have more design possibilities.
Those new to Joomla might think why are these custom fields even useful? Or is it even that big a deal? Well yes, it is, with the introduction of this powerful feature in Joomla it now becomes easy to add any new field without having to interfere in the PHP file and call your developer in the middle of the night! Developer or no developer anyone can work with these with just a few clicks here and there.
Now, this article will help you understand what each of these custom fields means and how improved they are in the new Joomla 4. Let's begin…
Custom Fields and their Types
In the left sidebar, you will see the Toggle Menu, where under the Content dropdown you have the Field & Field Groups options. As you know or if not then the Field option will let you create the custom fields with the help of 15 different types of custom fields available. And the Field Groups option will let you create custom fields using different combinations of the custom field types available for your articles or contacts or user groups.
So let’s learn about each of these custom field types, that’ll be used within the articles:
As the name says for itself this field type is used to set the dates. In the general tab, you can set some of the basic values like label, description, or choosing to make the field required and others like so. Whereas the Options tab has more customization options specific to the field type like field & label class, layout, automatic display, and others.
With this field, you can add multiple choice options to choose from within the articles or contacts. Again the general tab has some of the common options where you can set the label, checkboxes default values, and others. The Options tab remains the same as with the others.
As simple as adding colors on your post can be done here using the color field type. This field displays the color codes if you wish to mention any. Like other types, the default options are all under the General tab and the more common specific ones in the Options tab.
If you want to add or make any custom changes then the editor field type will let you do just that. This editor will show up in your let’s say articles backend where you can add the extra information or changes you would like to show along with the basic article or contact or user group on the frontend. Again the setting options are divided into 2 tabs General & Options tab.
This field type is used to add any custom numeric value by showing up as an integer field type on the frontend. As it says, you can adjust the first and last numeric values, add value increments, and many more under the main General tab. For more specific customization the options are under the Options tab.
As the name speaks for itself, this field type will let you create a list in the backend and let users choose the values from that list. Again all the default options are under the General tab and customization options are under the Options tab.
List of Images
If you wish to add more images other than the default articles one then you can create a custom field of type List of Images that will help you design such a layout. In this you can even select a specific folder whose images will be shown. All this can be set under the main General tab.
If you don’t just want to show just the images but other media types as well like videos then you can create a custom field of the Media type. Though it is somewhat similar to the list of images field type here the folder type remains that asset in your global Joomla setup backend. All the important default values here also come under the General tab.
Similar to checkboxes and lists, if you have fewer options to choose from then you can create a custom field of type Radio. This field won’t allow you to have multiple selections at the same time. You can set its values under the General tab and customize it further in the Options tab.
When you want to add a list with some definite values where the data need to be fetched from your site’s database then in that case you will have to have an SQL field type. With this, the query will generate an output as the value that will be shown on the frontend.
As simple as adding a piece of extra information on your already created content you can add an extra text field type to do so. But with this, the character length will be limited as defined by you. This field will then show up in the article's backend where you can mention further details. From setting character limits to making the field required all such values are set under the General tab.
Again, similar to the text field, if you want to add more extra content rather than just some limited characters or a single line then in that case you can create a custom field of type textarea. With this, you can set the number of rows & columns that you want for the extra content and as we had in text type here also you can set the character limit under the options in the General tab.
Now with all these content-based field types we also have a type where you can add links within the content. For this, you will have to create a custom field of URL type. Here you can even set the schemes for different sorts of link types and much more.
I suppose you would like to show the author name in between the article’s content than for that, you can create a custom field of type user. In this just select the user from the backend whose details will be displayed on the frontend. All this can again be done in the general tab & for further customization with special classes, you can add it in the Options tab.
Similar to what the user field type does, the only difference being here you can select the user groups from the backend like guests, managers, publishers and etc. Just create this custom field and select your user groups from the list at a content level that will then be displayed on the frontend.
Now if you want to show multiple field types at the same time then you can create another custom field of the type subfields that will display your other custom fields through which you can add the extra custom information. Let’s say you created custom fields of types Date & Text, then you add these fields as subfields and access their values on a content level which will then be displayed on the frontend.
So now you have an idea of the different types of custom fields added in Joomla 4. With whose help you can add the extra information and extend Joomla to the next level. Thanks to Joomla’s developer community that they decided to add such a powerful feature in Joomla that is very much flexible to use for anyone be it a developer or a noob!
PS: Also, we got the news that Joomla 4 will be shipped with Bootstrap 5.