diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md index d2205cd9b..2ed7f88f4 100644 --- a/UPGRADE-4.0.md +++ b/UPGRADE-4.0.md @@ -13,6 +13,18 @@ Please read [3.x](https://github.com/sonata-project/SonataPageBundle/tree/3.x) u See also the [diff code](https://github.com/sonata-project/SonataPageBundle/compare/3.x...4.0.0). +## Assets +Removed `assets.stylesheets` and `assets.javascripts` from sonata_page configuration + +```diff +sonata_page: +- assets: +- stylesheets: +- # Defaults: +- - bundles/sonatapage/app.css +- javascripts: +``` + ### Template Remove deprecate blocks from `base_layout.html.twig` diff --git a/docs/reference/advanced_configuration.rst b/docs/reference/advanced_configuration.rst index 0927e308c..5017a2d27 100644 --- a/docs/reference/advanced_configuration.rst +++ b/docs/reference/advanced_configuration.rst @@ -38,11 +38,6 @@ Full configuration options: - /admin(.*)/ default_page_service: sonata.page.service.default default_template: ~ # Required - assets: - stylesheets: - # Defaults: - - bundles/sonatapage/app.css - javascripts: templates: # Required # Prototype id: diff --git a/docs/reference/getting_started.rst b/docs/reference/getting_started.rst index 40e189f50..52119780d 100644 --- a/docs/reference/getting_started.rst +++ b/docs/reference/getting_started.rst @@ -180,7 +180,7 @@ Before adding a new block, please look to the default layout container ``content_bottom`` of the global page. A global page does not belong to the current url but it can be used on different pages. -* ``page_include_stylesheets`` and ``page_include_javascripts`` : insert the +* ``sonata_page_include_stylesheets`` and ``sonata_page_include_javascripts`` : insert the stylesheets and javascripts used on the page by the related blocks. The block management is done from the front end. A block can be moved and diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 6599f988b..9dc04dac3 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -132,22 +132,6 @@ public function getConfigTreeBuilder(): TreeBuilder ->isRequired() ->end() - ->arrayNode('assets') - ->addDefaultsIfNotSet() - ->children() - ->arrayNode('stylesheets') - ->defaultValue([ - 'bundles/sonatapage/app.css', - ]) - ->prototype('scalar')->end() - ->end() - ->arrayNode('javascripts') - ->defaultValue([]) - ->prototype('scalar')->end() - ->end() - ->end() - ->end() - ->arrayNode('templates') ->isRequired() ->useAttributeAsKey('id') diff --git a/src/DependencyInjection/SonataPageExtension.php b/src/DependencyInjection/SonataPageExtension.php index 19ebd04f0..832fd781e 100644 --- a/src/DependencyInjection/SonataPageExtension.php +++ b/src/DependencyInjection/SonataPageExtension.php @@ -84,8 +84,6 @@ public function load(array $configs, ContainerBuilder $container): void $this->configurePageDefaults($container, $config); $this->configurePageServices($container, $config); - $container->setParameter('sonata.page.assets', $config['assets']); - $container->setParameter('sonata.page.skip_redirection', $config['skip_redirection']); $container->setParameter('sonata.page.hide_disabled_blocks', $config['hide_disabled_blocks']); $container->getDefinition('sonata.page.decorator_strategy') diff --git a/src/Resources/config/twig.php b/src/Resources/config/twig.php index 2dff56951..5ed94f3d6 100644 --- a/src/Resources/config/twig.php +++ b/src/Resources/config/twig.php @@ -38,6 +38,5 @@ new ReferenceConfigurator('sonata.page.cms_manager_selector'), new ReferenceConfigurator('sonata.page.site.selector'), new ReferenceConfigurator('sonata.page.template_manager'), - '%sonata.page.assets%', ]); }; diff --git a/src/Twig/GlobalVariables.php b/src/Twig/GlobalVariables.php index 945177d11..dc20ef7bc 100644 --- a/src/Twig/GlobalVariables.php +++ b/src/Twig/GlobalVariables.php @@ -33,32 +33,16 @@ final class GlobalVariables private TemplateManagerInterface $templateManager; - /** - * @var array{ - * javascript: array, - * stylesheet: array - * } - */ - private array $assets; - - /** - * @param array{ - * javascript: array, - * stylesheet: array - * } $assets - */ public function __construct( SiteManagerInterface $siteManager, CmsManagerSelectorInterface $cmsManagerSelector, SiteSelectorInterface $siteSelector, - TemplateManagerInterface $templateManager, - array $assets + TemplateManagerInterface $templateManager ) { $this->siteManager = $siteManager; $this->cmsManagerSelector = $cmsManagerSelector; $this->siteSelector = $siteSelector; $this->templateManager = $templateManager; - $this->assets = $assets; } /** @@ -98,15 +82,4 @@ public function getDefaultTemplate(): string return $template->getPath(); } - - /** - * @return array{ - * javascript: array, - * stylesheet: array - * } - */ - public function getAssets(): array - { - return $this->assets; - } } diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index 502c8f899..8a391b804 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -121,12 +121,6 @@ public function testPageWithMatrix(): void 0 => 'admin(.*)', ], 'default_page_service' => 'sonata.page.service.default', - 'assets' => [ - 'stylesheets' => [ - 'bundles/sonatapage/app.css', - ], - 'javascripts' => [], - ], 'templates_admin' => [ 'list' => '@SonataPage/PageAdmin/list.html.twig', 'tree' => '@SonataPage/PageAdmin/tree.html.twig', @@ -190,12 +184,6 @@ public function testPageWithoutMatrix(): void 0 => 'admin(.*)', ], 'default_page_service' => 'sonata.page.service.default', - 'assets' => [ - 'stylesheets' => [ - 'bundles/sonatapage/app.css', - ], - 'javascripts' => [], - ], 'templates_admin' => [ 'list' => '@SonataPage/PageAdmin/list.html.twig', 'tree' => '@SonataPage/PageAdmin/tree.html.twig',