-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Remove usage of sonata_admin twig global variable #1297
Remove usage of sonata_admin twig global variable #1297
Conversation
8d5dc23
to
d298161
Compare
2379846
2379846
to
cb8376e
Compare
cb8376e
to
a50d56f
Compare
$container->getDefinition('twig') | ||
->addMethodCall('addGlobal', ['sonata_page', new Reference('sonata.page.twig.global')]); | ||
->addMethodCall('addGlobal', ['sonata_page', new Reference('sonata.page.twig.global')]) | ||
->addMethodCall('addGlobal', ['sonata_page_admin', new Reference('sonata.page.admin.page')]); |
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 SonataAdminBundle
is an optional dependency, so this can be null @VincentLanglet
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.
Why is it optional ? It's in the require
https://github.com/sonata-project/SonataPageBundle/blob/3.x/composer.json#L28
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.
cc @franmomu
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.
Fixed in #1310, the services are loaded if SonataAdminBundle
is available:
SonataPageBundle/src/DependencyInjection/SonataPageExtension.php
Lines 77 to 85 in 654fc11
if (isset($bundles['SonataAdminBundle'])) { | |
$loader->load('admin.xml'); | |
if (!$config['direct_publication']) { | |
$container->removeDefinition('sonata.page.admin.extension.snapshot'); | |
} | |
$this->configureTemplatesAdmin($container, $config); | |
} |
but I guess another PR is needed to make it really optional.
Subject
In order to fix #1282, I've added a
sonata_page_admin
variable which holds thesonata.page.admin.page
service.I am targeting this branch, because these changes are BC.
Closes #1282 and #1299.
Changelog