allow to change 'label_translator_strategy' for all admins at global config of 'sonata_admin.admin_services' key#4637
Conversation
… with 'sonata_admin.admin_services.label_translator_strategy'
|
Please format your commit message according to our rules :
Bad example : Good example: More details in CONTRIBUTING.md |
|
@greg0ire updated |
|
hm...still fail at: |
| ->end() | ||
| ->end() | ||
| ->arrayNode('admin_services') | ||
| ->prototype('array') |
There was a problem hiding this comment.
Uuuuuh why did you remove this?
There was a problem hiding this comment.
$rootNode = $treeBuilder->root('sonata_admin', 'array');
this already defining the global node type, and mentioned ->prototype('array') breaks underlying nodes, configuration in yml doesn't work and throws that error as in #3190 .
There was a problem hiding this comment.
I think you are removing the ability to set admin services on an admin per admin basis when doing that, aren't you? Why not create a default_admin_service node instead, and not touch that? This looks like a BC-break.
|
Please add a test to avoid breaking this feature again in the future. |
|
@OskarStark @jlamur test added. But not sure on the underlying core admin bundle logic, where is a label_translation_strategy getting over the particular admin service settings. From what i found it is the global service definition, so my test watching only that. PS. not sure why StyleCI still failing |
Public methods must be above protected ones. |
| 'route_builder' => 'sonata.admin.route.path_info'. | ||
| (($manager_type == 'doctrine_phpcr') ? '_slashes' : ''), | ||
| 'label_translator_strategy' => 'sonata.admin.label.strategy.native', | ||
| 'label_translator_strategy' => null !== $settings['label_translator_strategy'] ? $settings['label_translator_strategy'] : 'sonata.admin.label.strategy.native', |
There was a problem hiding this comment.
Isn't this code supposed to achieve the exact same goal?
There was a problem hiding this comment.
you mean $definition->addMethodCall($method, $args); ?
currently 'label_translator_strategy' => 'sonata.admin.label.strategy.native' is hardcoded, and there is no way to globaly change the stratagy, only one by one for each admin service
There was a problem hiding this comment.
My bad, I missed the fact that $settings is not $overwriteAdminConfiguration.
Anyway, if other properties sonata_admin.admin_services.* work out of the box (I mean without such ternary condition here), I don't get why you have to override this one here.
There was a problem hiding this comment.
not sure about other properties yet. I was needed to change the label translation strategy for all my admin services and faced this issue
but i guess this settings will have similar issue if will try to set them in a global configuration area
There was a problem hiding this comment.
That's why I asked. Could you test if they work? If not we will need a fix for all of them with a cleaner solution.
|
Related #3319 , which I closed because it did not seem very useful to others. But since you are proposing it too, it might mean that it would in fact be useful. |
|
This documentation saying that its possible to set the In fact this is a Moreover, the issue is not only limited to
IMO this PR should focus on implementing all these feature globally and not only the |
|
Could you please rebase your PR and fix merge conflicts? |
|
This issue should be fixed in the latest stable version. If this is still present, feel free to reopen this issue |
|
@core23 This issue is still present. I saw no way to set global default admin services. |
|
I think @jlamur is right. Perhaps a |
Closes #3190
Follows PR #4577
Changelog
Subject
when we want to setup label_translator_strategy globally for all admins, we should use option sonata.admin_services.sonata_admin.admin_services which should be set in global configuration for sonata_admin.
But it doesn't work, first it rise same errors as described in issue #3190, but then it was not really applying the new strategy and still was using 'native' strategy.
This PR suppose to fix that and make the option available. Example: