Anyone able to help?
I have a module that opens up a form to add repeatable sections, the form itself also contains repeatable fields, and I am trying to loop though the arrays and output the content.
if I var_dump($settings->rows);
I get
array (size=2)
0 =>
object(stdClass)[6006]
public 'label' => string 'Row One' (length=7)
public 'title' =>
array (size=5)
0 => string 'Avatar' (length=6)
1 => string '1' (length=1)
2 => string '2009' (length=4)
3 => string '83%' (length=3)
4 => string '$2.7B' (length=5)
1 =>
object(stdClass)[6007]
public 'label' => string 'Row two' (length=7)
public 'title' =>
array (size=5)
0 => string 'Titanic' (length=7)
1 => string '2' (length=1)
2 => string '1997' (length=4)
3 => string '88%' (length=3)
4 => string '$2.1B' (length=5)
And this is where I am at with my frontend code
<?php foreach ( $tablerows as $tablerow ) {
echo '<tr>';
foreach ( $tablerow as $tablecell ) {
echo '<td>' . $tablecell . '</td>';
}
echo '</tr>';
} ?>
The output html should look like
<tr>
<td>Avatatar</td>
<td>1</td>
<td>2009</td>
<td>83%</td>
<td>$2.7BN/td>
</tr>
<tr>
<td>Titanic</td>
<td>2</td>
<td>1997</td>
<td>88%</td>
<td>$2.1B</td>
</tr>
`