16 const CODE =
'block_renderer';
21 private $configuration;
34 $this->
template = $template;
46 $this->setUpConfiguration(
$message->getData(), $initializationData);
48 $result = $this->
template->toHtml();
50 $this->tearDownConfiguration();
60 private function setUpConfiguration(array $configuration, array $initializationData)
62 if (!isset($initializationData[
'template'])) {
63 throw new \InvalidArgumentException(
'Template should be provided for the renderer.');
68 $this->
template->setTemplate($initializationData[
'template']);
69 $this->
template->setData($configuration);
75 private function tearDownConfiguration()
77 foreach (array_keys($this->configuration) as $key) {
78 $this->
template->unsetData($key);
79 unset($this->configuration[$key]);
82 $this->
template->setTemplate(
'');
__construct(Template $template)
render(MessageInterface $message, array $initializationData)