Skip to content

Instantly share code, notes, and snippets.

@AlekVolsk
Last active February 10, 2019 10:45
Show Gist options
  • Save AlekVolsk/77586974ebd00c597e1d2f034d68f29b to your computer and use it in GitHub Desktop.
Save AlekVolsk/77586974ebd00c597e1d2f034d68f29b to your computer and use it in GitHub Desktop.
Получение допполей Joomla для элемента в читабельном виде
<?php
// === begin: если в $item полей нет ===
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$item->jcfields = FieldsHelper::getFields('com_content.article', $item, true);
// === end: если в $item полей нет ===
$fields = [];
foreach($item->jcfields as $jcfield) {
$fields[$jcfield->name] = $jcfield;
}
// теперь поле доступно в $fields[ 'fieldName' ]
// для перфекционистов-изоляторов можно вместо $fields указать $item->fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment