TIPS - Using custom fields by name

Using custom fields by name

Hello super joomlers!

I know, I know. You will likely tell me that there will be conflicts by using custom fields by name because names are not necessarily unique.

But there is a solution for that. Using a naming convention for your custom fields. For example for article content custom fields you could use something like article-my-field.

Besides this convention. You can use this oneliner sample code rather than trying to memorize custom fields id by heart even if we might have written the ids down on a document it's a painful task.

Here is an attempt to simplify this task.


$fields_by_name = \Joomla\Utilities\ArrayHelper::pivot($list_of_fields, 'name');

No thoughts on “TIPS - Using custom fields by name”

Alexandre ELISÉ

Développeur #PHP spécialiste #Joomla! Si mon travail vous a plu n'hésitez pas à laisser votre avis sur Google Reviews. Si mes articles vous ont été utiles vous pouvez me le dire avec Paypal.me ça m'encourage à continuer et me permet de savoir que vous apprecier le contenu. Sinon vous pouvez toujours m'envoyer un email pour me faire part de vos suggestions.

Get the newsletter

Super Joomlers! Get the most out of Joomla!
We hate spam as much as you do and we will not send you email without your prior consent. You can unsubscribe / resubscribe any time you want.