1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <?php
foreach ($this->item->jcfields as $field) {
if ('films-pros' === $field->name && 'subform' === $field->type) {
$field_value = json_decode($this->item->jcfields[111]->rawvalue, true);
echo '<pre>', var_dump($field_value), '</pre>'; // ok
$app = Factory::getApplication();
$factory = $app->bootComponent('com_content')->getMVCFactory();
foreach ($field->subform_rows as $subform_row) {
foreach ($subform_row as $subField) {
if ('film-pro-lie' === $subField->fieldname) {
$menuTitle = $subField->value;
$article_id = 119; // Valur en dur comment la récupérer ?
echo '<pre>', var_dump($article_id), '</pre>';
$table = $factory->createTable('Article', 'Table');
$table->load($article_id);
$item_catid = $table->catid;
echo '<pre>', var_dump($item_catid), '</pre>';
echo HTMLHelper::link(
Route::link("site", "index.php?option=com_content&view=article&id={$article_id}&catid={$item_catid}"),
$menuTitle
);
}
}
}
}
}
?> |
Partager