Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/LiveComponent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 2.25.0

- Add support for [Symfony UID](https://symfony.com/doc/current/components/uid.html) hydration/dehydration
- `ComponentWithFormTrait` now correctly checks for a `TranslatableInterface` placeholder for `<select>` elements

## 2.23.0

Expand Down
4 changes: 3 additions & 1 deletion src/LiveComponent/src/ComponentWithFormTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
use Symfony\Contracts\Translation\TranslatableInterface;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\Attribute\PreReRender;
use Symfony\UX\LiveComponent\Util\LiveFormUtility;
Expand Down Expand Up @@ -286,7 +287,8 @@ private function extractFormValues(FormView $formView): array
)
&& !$child->vars['expanded'] // is a <select> (not a radio/checkbox)
&& !$child->vars['multiple'] // is not multiple
&& !\is_string($child->vars['placeholder']) // has no placeholder (empty string is valid)
&& !\is_string($child->vars['placeholder']) // has no placeholder (empty string is valid)
&& !$child->vars['placeholder'] instanceof TranslatableInterface // has no placeholder (translatable interface is valid)
) {
$choices = $child->vars['preferred_choices'] ?: $child->vars['choices']; // preferred_choices has precedence, as they rendered before regular choices
do {
Expand Down
Loading