https://forum.joomla.org/viewtopic.php?t=969543
This calls custom field functions:
It should be placed after "defined('_JEXEC') or die";
CODE: SELECT ALL
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
This cycles through all fields:
Place this code after foreach loop in module:
CODE: SELECT ALL
$fields = $item->jcfields ?: FieldsHelper::getFields($context, $item, true);
foreach($fields as $field){
if ($field->value){
$item->fields[$field->name] = $field;
}
}
And this renders specified field data:
CODE: SELECT ALL
echo $item->fields['my-field-name']->value;
If someone has better solution, like how to get classes rendered as well, fell free to post it here.