Last active
February 10, 2019 10:45
-
-
Save AlekVolsk/77586974ebd00c597e1d2f034d68f29b to your computer and use it in GitHub Desktop.
Получение допполей Joomla для элемента в читабельном виде
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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