diff --git a/docs/reference/installation.rst b/docs/reference/installation.rst
index 56261009a..5fabd0960 100644
--- a/docs/reference/installation.rst
+++ b/docs/reference/installation.rst
@@ -138,16 +138,7 @@ SonataAdminBundle Configuration
SonataBlockBundle Configuration
-------------------------------
-.. code-block:: yaml
-
- # config/packages/sonata_block.yaml
-
- sonata_block:
- context_manager: sonata.page.block.context_manager
-
-.. note::
-
- Please you need to use the context ``sonata_page_bundle`` in the SonataBlockBundle to add block into a Page.
+You need to use the context ``sonata_page_bundle`` in the SonataBlockBundle to add block into a Page.
Security Configuration
----------------------
diff --git a/src/Block/BlockContextManager.php b/src/Block/BlockContextManager.php
deleted file mode 100644
index c4f104706..000000000
--- a/src/Block/BlockContextManager.php
+++ /dev/null
@@ -1,50 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Sonata\PageBundle\Block;
-
-use Sonata\BlockBundle\Block\BlockContextInterface;
-use Sonata\BlockBundle\Block\BlockContextManagerInterface;
-
-final class BlockContextManager implements BlockContextManagerInterface
-{
- private BlockContextManagerInterface $blockContextManager;
-
- public function __construct(BlockContextManagerInterface $blockContextManager)
- {
- $this->blockContextManager = $blockContextManager;
- }
-
- public function addSettingsByType(string $type, array $settings, bool $replace = false): void
- {
- $this->blockContextManager->addSettingsByType($type, $settings, $replace);
- }
-
- public function addSettingsByClass(string $class, array $settings, bool $replace = false): void
- {
- $this->blockContextManager->addSettingsByClass($class, $settings, $replace);
- }
-
- public function get($meta, array $settings = []): BlockContextInterface
- {
- return $this->blockContextManager->get($meta, [
- 'manager' => false,
- 'page_id' => false,
- ]);
- }
-
- public function exists(string $type): bool
- {
- return $this->blockContextManager->exists($type);
- }
-}
diff --git a/src/Resources/config/block.xml b/src/Resources/config/block.xml
index c95c1739c..c56263de9 100644
--- a/src/Resources/config/block.xml
+++ b/src/Resources/config/block.xml
@@ -25,9 +25,6 @@
-
-
-
diff --git a/src/Twig/Extension/PageExtension.php b/src/Twig/Extension/PageExtension.php
index 739f7ddcd..8de22e455 100644
--- a/src/Twig/Extension/PageExtension.php
+++ b/src/Twig/Extension/PageExtension.php
@@ -18,7 +18,6 @@
use Sonata\PageBundle\Exception\PageNotFoundException;
use Sonata\PageBundle\Model\PageBlockInterface;
use Sonata\PageBundle\Model\PageInterface;
-use Sonata\PageBundle\Model\SnapshotPageProxy;
use Sonata\PageBundle\Site\SiteSelectorInterface;
use Symfony\Bridge\Twig\Extension\HttpKernelExtension;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -196,27 +195,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 '';
}
- $page = $block->getPage();
-
- // defined extra default key for the cache
- $pageCacheKeys = null !== $page ? [
- 'manager' => $page instanceof SnapshotPageProxy ? 'snapshot' : 'page',
- 'page_id' => $page->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);
}
diff --git a/tests/App/config/sonata.yaml b/tests/App/config/sonata.yaml
index 276084472..4865da6e4 100644
--- a/tests/App/config/sonata.yaml
+++ b/tests/App/config/sonata.yaml
@@ -3,7 +3,6 @@ sonata_block:
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
- context_manager: sonata.page.block.context_manager
default_contexts: [sonata_page_bundle]
sonata_page:
diff --git a/tests/Block/BlockContextManagerTest.php b/tests/Block/BlockContextManagerTest.php
deleted file mode 100644
index b3079d10d..000000000
--- a/tests/Block/BlockContextManagerTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Sonata\PageBundle\Tests\Block;
-
-use PHPUnit\Framework\TestCase;
-use Sonata\BlockBundle\Block\BlockContext;
-use Sonata\BlockBundle\Block\BlockContextInterface;
-use Sonata\BlockBundle\Model\Block;
-
-/**
- * @author Sullivan Senechal
- */
-final class BlockContextManagerTest extends TestCase
-{
- public function testGetWithValidData(): void
- {
- $settings = [
- 'use_cache' => true,
- 'extra_cache_keys' => [],
- 'attr' => [],
- 'template' => 'test_template',
- 'ttl' => 0,
- 'manager' => false,
- 'page_id' => false,
- ];
- $block = new Block();
- $block->setSettings($settings);
- $blockContext = new BlockContext($block, $block->getSettings());
-
- static::assertInstanceOf(BlockContextInterface::class, $blockContext);
- static::assertSame($settings, $blockContext->getSettings());
- static::assertSame('test_template', $blockContext->getTemplate());
- }
-}