Skip to content

Commit

Permalink
Remove BlockContextManager
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Aug 6, 2022
1 parent 6bb9218 commit cfac53b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 114 deletions.
50 changes: 0 additions & 50 deletions src/Block/BlockContextManager.php

This file was deleted.

3 changes: 0 additions & 3 deletions src/Resources/config/block.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
<argument type="service" id="sonata.block.renderer"/>
<argument type="service" id="sonata.block.context_manager"/>
</service>
<service id="sonata.page.block.context_manager" class="Sonata\PageBundle\Block\BlockContextManager">
<argument type="service" id="sonata.block.context_manager.default"/>
</service>
<service id="sonata.page.block.breadcrumb" class="%sonata.page.block.breadcrumb.class%">
<tag name="sonata.block"/>
<tag name="sonata.breadcrumb"/>
Expand Down
21 changes: 5 additions & 16 deletions src/Twig/Extension/PageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,14 @@ public function renderContainer($name, $page = null, array $options = [])
*/
public function renderBlock(PageBlockInterface $block, array $options = [])
{
if (false === $block->getEnabled() && !$this->cmsManagerSelector->isEditor() && $this->hideDisabledBlocks) {
if (
false === $block->getEnabled()
&& !$this->cmsManagerSelector->isEditor()
&& $this->hideDisabledBlocks
) {
return '';
}

// defined extra default key for the cache
$pageCacheKeys = [
'manager' => $block->getPage() instanceof SnapshotPageProxy ? 'snapshot' : 'page',
'page_id' => $block->getPage()->getId(),
];

// build the parameters array
$options = array_merge([
'use_cache' => $options['use_cache'] ?? true,
'extra_cache_keys' => [],
], $pageCacheKeys, $options);

// make sure the parameters array contains all valid keys
$options['extra_cache_keys'] = array_merge($options['extra_cache_keys'], $pageCacheKeys);

return $this->blockHelper->render($block, $options);
}

Expand Down
45 changes: 0 additions & 45 deletions tests/Block/BlockContextManagerTest.php

This file was deleted.

0 comments on commit cfac53b

Please sign in to comment.