From 773747eb33b4db8db0aed961f09a349ffae9bf4e Mon Sep 17 00:00:00 2001 From: Michael Aerni Date: Thu, 31 Oct 2024 16:32:21 -0400 Subject: [PATCH] Never render hidden fields on the frontend --- src/Form/Section.php | 4 +++- src/Form/Step.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Form/Section.php b/src/Form/Section.php index 00c16833..d9911ac1 100644 --- a/src/Form/Section.php +++ b/src/Form/Section.php @@ -42,6 +42,8 @@ public function instructions(): ?string public function fields(): Collection { - return Livewire::current()->fields->intersectByKeys(array_flip($this->fields)); + return Livewire::current()->fields + ->intersectByKeys(array_flip($this->fields)) + ->filter(fn ($field) => ! $field->hidden); } } diff --git a/src/Form/Step.php b/src/Form/Step.php index f77c623f..9ca4684c 100644 --- a/src/Form/Step.php +++ b/src/Form/Step.php @@ -45,7 +45,9 @@ public function instructions(): ?string public function fields(): Collection { - return Livewire::current()->fields->intersectByKeys(array_flip($this->fields)); + return Livewire::current()->fields + ->intersectByKeys(array_flip($this->fields)) + ->filter(fn ($field) => ! $field->hidden); } public function isPrevious(): bool