Skip to content

Commit

Permalink
Update Subform.php
Browse files Browse the repository at this point in the history
Hide values from subform
  • Loading branch information
obuisard committed Sep 9, 2023
1 parent a3e8aef commit 4919c82
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/fields/subform/src/Extension/Subform.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,21 @@ public function onCustomFieldsPrepareField($context, $item, $field)
$row_subfields[$subfield->fieldname] = $subfield;
}

// Check conditions on fields (through the showon attribute)
// Done here to make sure all fields have a raw value

foreach ($row_subfields as $key => $subfield) {
$showOn = $subfield->params->get('showon', '');

if (empty($showOn)) {
continue;
}

if (!FieldsHelper::matchShowon($showOn, $row_subfields)) {
unset($row_subfields[$key]);
}
}

// Store all the sub fields of this row
$subform_rows[] = $row_subfields;
}
Expand Down

0 comments on commit 4919c82

Please sign in to comment.