Skip to content

Commit dba32af

Browse files
authored
Never render hidden fields on the frontend (#74)
1 parent f8a6294 commit dba32af

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Form/Section.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function instructions(): ?string
4242

4343
public function fields(): Collection
4444
{
45-
return Livewire::current()->fields->intersectByKeys(array_flip($this->fields));
45+
return Livewire::current()->fields
46+
->intersectByKeys(array_flip($this->fields))
47+
->filter(fn ($field) => ! $field->hidden);
4648
}
4749
}

src/Form/Step.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ public function instructions(): ?string
4545

4646
public function fields(): Collection
4747
{
48-
return Livewire::current()->fields->intersectByKeys(array_flip($this->fields));
48+
return Livewire::current()->fields
49+
->intersectByKeys(array_flip($this->fields))
50+
->filter(fn ($field) => ! $field->hidden);
4951
}
5052

5153
public function isPrevious(): bool

0 commit comments

Comments
 (0)