It works but it is not great. It's about getting the fields of a subform to display the urls and other fields in a loop
Today I have PHP code:
<?php if (!empty($this->item->jcfields[111]->value)): ?>
<br /><b><span><i class="fa fa-link fa-1x" aria-hidden="true"></i></span> Pros des films :</b>
<?php
$field_value = json_decode($this->item->jcfields[111]->rawvalue);
$app = Factory::getApplication();
$factory = $app->bootComponent('com_content')->getMVCFactory();
$lang="fr";
$item_id="159";
?>
<?php foreach ($field_value as $value): ?>
<?php
$article_id = $value->field110;
$table = $factory->createTable('Article', 'Table');
$table->load($article_id);
$item_catid = $table->catid;
echo HTMLHelper::link(
Route::_("/index.php?option=com_content&view=article&id={$article_id}&catid={$item_catid}&Itemid={$item_id}&lang={$lang}"),
$table->alias
);
?>
<?php endforeach ?>
<?php endif ?>
The rendering is : Pros des films : kamea-meah meteore-films
Le code HTML est : Code HTML:
<a href="/index.php?option=com_content&view=article& id=119&catid=21&Itemid=159&lang=fr">kamea-meah</a>
<a href="/index.php?option=com_content&view=article& id=122&catid=21&Itemid=159&lang=fr">meteore-films</a>
1/ how to have a SEF url ? I have set the SEF url in the general config
2/ how to add another subform field and formatting?
Film pros : kamea-meah (production) - meteore-films (direction)
DEBUG
echo '<pre>', print_r($field_value), '</pre>';
=>
stdClass Object
(
[row0] => stdClass Object
(
[field110] => 119
[field112] => Array
(
[0] => film_rea
)
)
[row1] => stdClass Object
(
[field110] => 122
)
)
I'll need to retrieve the term "director from the value of "film_rea" custom field