context = $context; $this->uiComponentFactory = $uiComponentFactory; } /** * Action for AJAX request * * @return void */ public function execute() { if ($this->_request->getParam('namespace') === null) { $this->_redirect('noroute'); return; } $component = $this->uiComponentFactory->create($this->_request->getParam('namespace')); $this->prepareComponent($component); $this->_response->appendBody((string) $component->render()); } /** * Call prepare method in the component UI * * @param UiComponentInterface $component * @return void */ private function prepareComponent(UiComponentInterface $component) { foreach ($component->getChildComponents() as $child) { $this->prepareComponent($child); } $component->prepare(); } }