Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Feb 27, 2022
1 parent 081da85 commit 62f984f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function process(ContainerBuilder $container): void
$labelCatalogue = $attributes['label_catalogue'] ?? $defaultValues['label_catalogue'];

// NEXT_MAJOR: Remove the `label_catalogue` fallback.
$groupTranslationDomain = $attributes['translation_domain'] ?? $defaultValues['label_catalogue'] ?? $defaultValues['translation_domain'];
$groupTranslationDomain = $attributes['translation_domain'] ?? $attributes['label_catalogue'] ?? $defaultValues['translation_domain'];
$icon = $attributes['icon'] ?? $defaultValues['icon'];
$onTop = $attributes['on_top'] ?? false;
$keepOpen = $attributes['keep_open'] ?? false;
Expand Down
4 changes: 3 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
* @phpstan-import-type ExtensionMap from \Sonata\AdminBundle\DependencyInjection\Compiler\ExtensionCompilerPass
* @phpstan-import-type Item from \Sonata\AdminBundle\Admin\Pool
*
* NEXT_MAJOR: Remove the default_label_catalogue key.
* @phpstan-type SonataAdminConfigurationOptions = array{
* confirm_exit: bool,
* default_admin_route: string,
* default_group: string,
* default_icon: string,
* default_translation_domain: string,
* default_label_catalogue: string,
* dropdown_number_groups_per_colums: int,
* form_type: 'standard'|'horizontal',
* html5_validate: bool,
Expand Down Expand Up @@ -338,7 +340,7 @@ public function getConfigTreeBuilder(): TreeBuilder
// NEXT_MAJOR: Use `messages` as default value and remove the deprecation.
->defaultValue(null)
->validate()
->always(function ($value) {
->always(static function ($value) {
if (null === $value) {
@trigger_error(
'Not setting the "sonata_admin.options.default_translation_domain" config option is deprecated'
Expand Down
18 changes: 9 additions & 9 deletions src/Form/Type/ModelAutocompleteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ static function (Options $options, $value): string {
$resolver->setDeprecated(
'btn_catalogue',
...BCDeprecation::forOptionResolver(
static function (Options $options, $value): string {
if ('SonataAdminBundle' !== $value) {
return 'Passing a value to option "btn_catalogue" is deprecated! Use "btn_translation_domain" instead!';
}

return '';
},
'4.x',
)
static function (Options $options, $value): string {
if ('SonataAdminBundle' !== $value) {
return 'Passing a value to option "btn_catalogue" is deprecated! Use "btn_translation_domain" instead!';
}

return '';
},
'4.x',
)
); // NEXT_MAJOR: Remove this deprecation notice.
}

Expand Down

0 comments on commit 62f984f

Please sign in to comment.