Skip to content

[LiveComponent] Fix default option extraction ignores Translatable #2621#2627

Merged
Kocal merged 1 commit into
symfony:2.xfrom
stehled:feature/fix-2621
Apr 19, 2025
Merged

[LiveComponent] Fix default option extraction ignores Translatable #2621#2627
Kocal merged 1 commit into
symfony:2.xfrom
stehled:feature/fix-2621

Conversation

@stehled

@stehled stehled commented Mar 6, 2025

Copy link
Copy Markdown
Contributor
Q A
Bug fix? yes
New feature? no
Issues Fix #2621
License MIT

Select placeholder in LiveForm will now accept string and TranslatableInterface from symfony/translation-contracts. Therefore mimicking of default browser behaviour will not happen for TranslatableInterface.

@carsonbot carsonbot added Bug Bug Fix Status: Needs Review Needs to be reviewed labels Mar 6, 2025
@stehled stehled changed the title Fix issue 2621 [LiveComponent] Fix issue 2621 Mar 6, 2025
@smnandre

smnandre commented Mar 6, 2025

Copy link
Copy Markdown
Member

Your composer.json change is not needed here, so let's avoid adding a new dependency for this single check :)

<?php

use Not\Installed\TranslatableInterface;

if ('aa' instanceof TranslatableInterface) {
    echo 'yep';
} else {
    echo 'nope';
}

--> "nope" and no error/warning (see https://3v4l.org/4nHHd )

(on contrary to something like this where an error would occur)

<?php

use Not\Installed\TranslatableInterface;

// This would trigger a Fatal Error Interface "Not\Installed\TranslatableInterface" not found
$foo = new class implements TranslatableInterface {};

Comment thread src/LiveComponent/composer.json Outdated
@carsonbot carsonbot added Status: Needs Work Additional work is needed Status: Needs Review Needs to be reviewed and removed Status: Needs Review Needs to be reviewed Status: Needs Work Additional work is needed labels Mar 6, 2025
@stehled

stehled commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

I've committed the suggestion, thank you for this comment, I've learned something new :)

@smnandre smnandre changed the title [LiveComponent] Fix issue 2621 [LiveComponent] Fix default option extraction ignores Translatable #2621 Mar 8, 2025
@smnandre smnandre added LiveComponent Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Mar 8, 2025
@smnandre

smnandre commented Mar 8, 2025

Copy link
Copy Markdown
Member

Thank you @stehled !

@Kocal Kocal force-pushed the feature/fix-2621 branch from d61ac59 to 201d31b Compare April 19, 2025 21:32
…TranslatableInterface` placeholder for `<select>` elements, close symfony#2621

Co-authored-by: Simon André <smn.andre@gmail.com>
@Kocal Kocal force-pushed the feature/fix-2621 branch from 201d31b to d36b98e Compare April 19, 2025 21:34
@Kocal

Kocal commented Apr 19, 2025

Copy link
Copy Markdown
Member

Thank you @stehled.

@Kocal Kocal merged commit e9403a6 into symfony:2.x Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Bug Fix LiveComponent Status: Reviewed Has been reviewed by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LiveForm] Required select with placeholder of TranslatableMessage has first value set upon rerender

4 participants