Skip to content

Instantly share code, notes, and snippets.

@qwersk
Last active August 17, 2017 09:41
Show Gist options
  • Save qwersk/025c09ad7c2e7621b5403bd123f6077f to your computer and use it in GitHub Desktop.
Save qwersk/025c09ad7c2e7621b5403bd123f6077f to your computer and use it in GitHub Desktop.
Get custom fields #JOOMLA
$customFieldnames = FieldsHelper::getFields('com_content.article', $item->id, true);
$customFieldIds = array_map(create_function('$o', 'return $o->id;'), $customFieldnames); //get custom field Ids by custom field names
$model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); //load fields model
$customFieldValues = $model->getFieldValues($customFieldIds , $item->id); //Fetch values for custom field Ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment