-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The 'field' option wasn't defined so it was never possible to even use a label for localized input (in StringQuery). Secondly the labels can now be translated using a TranslatableInterface value (for the Symfony bundle).
- Loading branch information
Showing
9 changed files
with
110 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lib/Symfony/SearchBundle/Type/TranslatableFieldTypeExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the RollerworksSearch package. | ||
* | ||
* (c) Sebastiaan Stok <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Rollerworks\Bundle\SearchBundle\Type; | ||
|
||
use Rollerworks\Component\Search\Extension\Core\Type\SearchFieldType; | ||
use Rollerworks\Component\Search\Field\AbstractFieldTypeExtension; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Contracts\Translation\TranslatableInterface; | ||
|
||
final class TranslatableFieldTypeExtension extends AbstractFieldTypeExtension | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->addAllowedTypes('label', TranslatableInterface::class); | ||
} | ||
|
||
public function getExtendedType(): string | ||
{ | ||
return SearchFieldType::class; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
lib/Symfony/SearchBundle/Type/TranslatableOrderFieldTypeExtension.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the RollerworksSearch package. | ||
* | ||
* (c) Sebastiaan Stok <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Rollerworks\Bundle\SearchBundle\Type; | ||
|
||
use Rollerworks\Component\Search\Field\AbstractFieldTypeExtension; | ||
use Rollerworks\Component\Search\Field\OrderFieldType; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Contracts\Translation\TranslatableInterface; | ||
|
||
final class TranslatableOrderFieldTypeExtension extends AbstractFieldTypeExtension | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->addAllowedTypes('label', TranslatableInterface::class); | ||
} | ||
|
||
public function getExtendedType(): string | ||
{ | ||
return OrderFieldType::class; | ||
} | ||
} |