-
-
Save sdboyer/5823704 to your computer and use it in GitHub Desktop.
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
<?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')); | |
} | |
foreach ($block->getContextDefinitions() as $slot => $context_info) { | |
if ($config['context'][$slot]['type'] == 'static') { | |
$data = typed_data_blah_blah_load($config[$slot]['address']); | |
} | |
else if ($config['context'][$slot]['type'] == 'argument') { | |
$data = $request->attributes->get($config[$slot]['address']); | |
} | |
else if ($config['context'][$slot]['type'] == 'derived') { | |
$base = $request->attributes->get($config[$slot]['request_address']); | |
$data = typed_data_blah_blah_load_from_thinger($base, $config[$slot]['typed_data_crazypants']); | |
} | |
$block->setContextValue($slot, $data); | |
} | |
$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