-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce SonataConfiguration class #6640
Introduce SonataConfiguration class #6640
Conversation
1834a75
to
f58b650
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we chose another directory ?
There is already too much file in the Admin directory IMHO.
Everything is Admin-related, since it's an Admin bundle.
Sure, I said in the description that I didn't know where to put it, so I'm open to suggestions, any idea where? |
No. I currently don't find better than admin.
|
Maybe just a |
|
1e85057
to
2034bef
Compare
I've moved it to the root directory, I don't see other possible classes going in the |
Root directory is fine, like @greg0ire explained 👌🏻 |
2034bef
to
fac90c9
Compare
UPGRADE-3.x.md
Outdated
@@ -4,12 +4,30 @@ UPGRADE 3.x | |||
UPGRADE FROM 3.xx to 3.xx | |||
========================= | |||
|
|||
### Deprecated `admin_pool` parameter in `sonata.admin.dashboard.top` and `onata.admin.dashboard.bottom` block events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Deprecated `admin_pool` parameter in `sonata.admin.dashboard.top` and `onata.admin.dashboard.bottom` block events. | |
### Deprecated `admin_pool` parameter in `sonata.admin.dashboard.top` and `sonata.admin.dashboard.bottom` block events. |
@@ -27,6 +27,8 @@ class GlobalVariablesCompilerPass implements CompilerPassInterface | |||
public function process(ContainerBuilder $container) | |||
{ | |||
$container->getDefinition('twig') | |||
->addMethodCall('addGlobal', ['sonata_configuration', new Reference('sonata.admin.configuration')]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blocker, more a personal choice. I would prefer sonata_config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the docs
Could you please rebase your PR and fix merge conflicts? |
48f7806
fac90c9
to
48f7806
Compare
Could you please rebase your PR and fix merge conflicts? |
48f7806
to
ac92837
Compare
Could you please rebase your PR and fix merge conflicts? |
ac92837
to
3981973
Compare
3981973
to
6809da5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog and the commit message should be updated about
sonata_config
This class will handle configuration for sonata which is currently holded by Pool class. It adds a global twig "sonata_config" variable in order to replace the current "sonata_admin" variable which all its methods are deprecated.
6809da5
to
d6750fc
Compare
Thanks @franmomu |
@franmomu You forgot change variable "sonata_admin" to "sonata_config" in src/Resources/views/Pager/base_links.html.twig template file (line 27). |
@@ -87,6 +98,11 @@ public function getAdminPool() | |||
*/ | |||
public function url($code, $action, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH) | |||
{ | |||
@trigger_error(sprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any replacement method for this method @VincentLanglet @franmomu ?
Our other bundles are still using this method, e.g. https://github.com/sonata-project/SonataPageBundle/blob/6b80c4a675303b2ad707655150dc02fd0be43efc/src/Resources/views/Block/block_pagelist.html.twig#L26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to pass the PageAdmin or the AdminPool in the BlockService https://github.com/sonata-project/SonataPageBundle/blob/3.x/src/Block/PageListBlockService.php
And then calling pageAdmin.generateUrl()
Subject
Part of #6624
This class (I wasn't sure in which folder should go) will handle configuration for sonata which is currently holded by Pool class.
It adds a global twig
sonata_config
variable in order to replace the currentsonata_admin
variable whose name could mislead to think that is some kind of admin.sonata_admin
is registered as global twig variable in:SonataAdminBundle/src/DependencyInjection/Compiler/GlobalVariablesCompilerPass.php
Lines 27 to 31 in ea9f3a4
SonataAdminBundle/src/Resources/config/core.php
Lines 216 to 223 in ea9f3a4
All
GlobalVariables
methods have been deprecated:url
andobjectUrl
were added in 964853c, I haven't found any use, this is usually done though theAdminInterface::generateUrl
andAdminInterface::generateObjectUrl
.getAdminPool
shouldn't be used in twig, it still has one usage, I'll comment later.getMosaicBackground
has been replaced bySonataConfiguration::getOption('mosaic_background')
.I added a
GroupExtension
Twig extension in order to handle some logic that was done in twig directly.I am targeting this branch, because these changes are BC.
Changelog
The only thing left is in
dashboard.html.twig
where there are a couple of calls:SonataAdminBundle/src/Resources/views/Core/dashboard.html.twig
Line 53 in ea9f3a4
SonataAdminBundle/src/Resources/views/Core/dashboard.html.twig
Line 128 in ea9f3a4
which I haven't used, but I guess someone using this event could inject the
Pool
service in the listener directly.