Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Render.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  private $context;
21 
25  private $uiComponentFactory;
26 
32  public function __construct(Context $context, UiComponentFactory $uiComponentFactory)
33  {
34  parent::__construct($context);
35  $this->context = $context;
36  $this->uiComponentFactory = $uiComponentFactory;
37  }
38 
44  public function execute()
45  {
46  if ($this->_request->getParam('namespace') === null) {
47  $this->_redirect('noroute');
48  return;
49  }
50 
51  $component = $this->uiComponentFactory->create($this->_request->getParam('namespace'));
52  $this->prepareComponent($component);
53  $this->_response->appendBody((string) $component->render());
54  }
55 
62  private function prepareComponent(UiComponentInterface $component)
63  {
64  foreach ($component->getChildComponents() as $child) {
65  $this->prepareComponent($child);
66  }
67  $component->prepare();
68  }
69 }
_redirect($path, $arguments=[])
Definition: Action.php:167
__construct(Context $context, UiComponentFactory $uiComponentFactory)
Definition: Render.php:32