Skip to content

Instantly share code, notes, and snippets.

@AlekVolsk
Created January 5, 2020 21:32
Show Gist options
  • Save AlekVolsk/b560d1115997b02256a10cee57fc56e6 to your computer and use it in GitHub Desktop.
Save AlekVolsk/b560d1115997b02256a10cee57fc56e6 to your computer and use it in GitHub Desktop.
Joomla: get custom fields in a articles module
<?php
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
foreach ($list as $item) {
$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
$fields = [];
foreach($item->jcfields as $jcfield)
{
$fields[$jcfield->name] = $jcfield;
}
// в массиве $fields все поля материала
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment