Sorry for getting back to this issue. Flex-Directory is evolving and get’s more and more awesome and useful. BUT when it comes to grouped or nested fields in a list field I totally get stucked in how to set up the right loop to output the right data. Like @zaldor I understand how to access data or values from an specific field inside a direct path. In my case I use Grav v1.4.5 with Flex-Directory v2.0.1 (Branch: feature/grav_objects). My setup follows a simple structure. I grouped four fields together. A date-field (days), a select-field (station), checkboxes (zeiten) and a text-field (notizen). The output from json looks like this:
"gi3egqlhpjnfmwcz": {
"published": true,
"last_name": "Lastname",
"first_name": "Firstname",
"header": {
"einsaetze": [
0 {
{
"days": "2018-06-12",
"station": "fabelwesenschule",
"zeiten": {
"zeit1": true,
"zeit2": true,
"zeit3": true,
"zeit4": true,
"zeit5": true,
"zeit6": false,
"zeit7": false,
"zeit8": false,
"zeit9": false,
"zeit10": false,
"zeit11": false
}
}
},
1 {
{
"days": "2018-06-12",
"station": "trickbox",
"zeiten": {
"zeit6": true,
"zeit7": true,
"zeit8": true,
"zeit9": true,
"zeit10": true,
"zeit11": true,
"zeit1": false,
"zeit2": false,
"zeit3": false,
"zeit4": false,
"zeit5": false
}
}
},
2 {
{
"days": "2018-06-28",
"station": "bauhuette",
"zeiten": {
"zeit4": true,
"zeit5": true,
"zeit6": true,
"zeit7": true,
"zeit8": true,
"zeit1": false,
"zeit2": false,
"zeit3": false,
"zeit9": false,
"zeit10": false,
"zeit11": false
}
}
}
]
From here I can get access by this if-condition:
{% if entry.header.einsaetze.0.zeiten.zeit1 is sameas(true) %}
<html_element class="checked"></html_element>
{% else %}
<html_element class="unchecked"></html_element>
{% endif %}
But I would like to iterate through the numbers which are the reference of how many groups are added. To avoid writing a bunch of twig for an (infinite) custom number of groups like ‘einsaetze.0.zeiten’ (only one group) or ‘einsaetze.4.zeiten’ (four groups). Any idea what I do wrong?
I’m sorry for bothering you guys. I’m working hard to understand the logics behind Grav and its assets (even with intensly reading of the lovely documentation). But I’m not that much familiar with programming languages at the moment (except of a basic level in js). So, give me a guess where to hit the Piñata.