Hi everyone. I’m trying to filter a structure field based on a variable, and am stuck, hoping someone could help me shed some light on what I’m sure is a basic q:
In the below code the ‘$ht->name’ value is what i want to also use in the second ‘finishes’ filter (i’ve used ht.name for now). What is the correct syntax to use here?
<?php
$housetypes = $page->housetypes()->toStructure();
foreach($housetypes as $ht): ?>
<div class="housetype-card col-lg-4">
<div class="image">image here</div>
<div class="title rbl-bg-olive d-flex flex-column">
<span><?= $ht->name() ?></span>
<span><?= $ht->area() ?></span>
</div>
<a href="#">View finishes & options</a>
<?php $finishes = $page->plots()->toStructure()->filterBy('housetype', '==', 'ht.name');
foreach($finishes as $finish): ?>
<?= $finish->plotnumber() ?>
<?= $finish->finish() ?>
<?= $finish->roof() ?>
<?php endforeach ?>
<?php endforeach ?>