Skip to content

Instantly share code, notes, and snippets.

@EclipseGc
Created June 20, 2013 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EclipseGc/5823702 to your computer and use it in GitHub Desktop.
Save EclipseGc/5823702 to your computer and use it in GitHub Desktop.
<?php
protected function renderBlocks(Request $request, BoundDisplayInterface $display) {
$blockFragments = array();
foreach ($display->getAllOuterBlockConfig() as $id => $config) {
$block = $display->getBlock($id);
if ($block instanceof SystemMainBlock) {
$block->setControllerClosure($request->attributes->get('_content_closure'));
}
$block_config = $block->getConfig();
foreach ($block_config['context'] as $local => $parent) {
$block->setContextValue($local, $display->getContextValue($parent));
}
$munged_request = clone $request;
// @todo muck with the Request here to get it to where we need
$blockFragments[$id] = $this->renderingStrategies[$config['strategy']]->render($block, $munged_request);
}
return $blockFragments;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment