Skip to content
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

Removing stylesheets and javascripts options from sonata_page #1596

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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