PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Helper / API Intermediate

Load Custom Fields Outside Article View with FieldsHelper::getFields()

Retrieves prepared Custom Fields for any article inside modules, plugins or custom components using FieldsHelper::getFields().

Updated on 24 November 2026 57 copies 204 views
modules/mod_example/src/Helper/ItemHelper.php
<?php

declare(strict_types=1);

use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;

$fields = FieldsHelper::getFields('com_content.article', $item, true);
$byName = [];

foreach ($fields as $field) {
    $byName[$field->name] = $field;
}

$clientName = $byName['cliente']->value ?? '';
Setting the third argument to true prepares formatted HTML values automatically.
modules/mod_example/src/Helper/ItemHelper.php
<?php
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$fields = FieldsHelper::getFields('com_content.article', $item, true);
Legacy Joomla 3.7+ snippet with JLoader::register().

Technical explanation and best practices

When fetching articles outside the native com_content view (such as in a custom module or endpoint), $item->jcfields is not auto-populated. Call FieldsHelper::getFields('com_content.article', $item, true) to load and prepare all values.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.