Skip to content

Commit

Permalink
Never render hidden fields on the frontend (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni authored Nov 1, 2024
1 parent f8a6294 commit dba32af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Form/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
4 changes: 3 additions & 1 deletion src/Form/Step.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dba32af

Please sign in to comment.