component = $component; $this->blockWrapperFactory = $blockWrapperFactory; $this->setNameInLayout($this->component->getName()); parent::__construct($context, $data); } /** * Render block HTML * * @return string */ protected function _toHtml() { foreach ($this->getChildNames() as $childName) { $childBlock = $this->getLayout()->getBlock($childName); if ($childBlock) { $wrapper = $this->blockWrapperFactory->create([ 'block' => $childBlock, 'data' => [ 'name' => 'block_' . $childName ] ]); $this->component->addComponent('block_' . $childName, $wrapper); } } $result = $this->component->render(); return (string)$result; } }