Skip to content

Commit

Permalink
Removing stylesheets and javascripts options from sonata_page (#1596)
Browse files Browse the repository at this point in the history
* Removing stylesheets and javascripts options from sonata_page

* Removed some assets config
  • Loading branch information
eerison authored Sep 8, 2022
1 parent a2fef9e commit 10550c6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 65 deletions.
12 changes: 12 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
5 changes: 0 additions & 5 deletions docs/reference/advanced_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 0 additions & 2 deletions src/DependencyInjection/SonataPageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 0 additions & 1 deletion src/Resources/config/twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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%',
]);
};
29 changes: 1 addition & 28 deletions src/Twig/GlobalVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,16 @@ final class GlobalVariables

private TemplateManagerInterface $templateManager;

/**
* @var array{
* javascript: array<string>,
* stylesheet: array<string>
* }
*/
private array $assets;

/**
* @param array{
* javascript: array<string>,
* stylesheet: array<string>
* } $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;
}

/**
Expand Down Expand Up @@ -98,15 +82,4 @@ public function getDefaultTemplate(): string

return $template->getPath();
}

/**
* @return array{
* javascript: array<string>,
* stylesheet: array<string>
* }
*/
public function getAssets(): array
{
return $this->assets;
}
}
12 changes: 0 additions & 12 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 10550c6

Please sign in to comment.