简体   繁体   中英

Joomla custom fields - article archived cannot be accessed

i have made an override for the archive com_content/views/archive/default.php where i want to access a custom field like i did with my override of the normal article view. But when i want to access the custom fields the array jcfields[] is empty. There are no entries like in the article view.

anyways i have a foreach loop like this ($this->items as $i => $item)

Is there something missing? If you need anymore infos, please let me know!

thanxs

i still don't unsterstand why the jcfields[] array is empty at an archived article.

But i found me a solution for the problem:

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$jcFields = FieldsHelper::getFields('com_content.article', $item, true);
$array = json_decode(json_encode($jcFields), True);
$fields = [];
foreach ($array as $field) {
  array_push($fields,$field['name'],$field['value'],$field['rawvalue']);
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM