-
-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bb9218
commit 8327117
Showing
6 changed files
with
6 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -33,8 +32,6 @@ | |
use Twig\TwigFunction; | ||
|
||
/** | ||
* PageExtension. | ||
* | ||
* @author Thomas Rabaix <[email protected]> | ||
*/ | ||
final class PageExtension extends AbstractExtension | ||
|
@@ -197,25 +194,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); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.