Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Structure.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Framework\View\Layout\Pool as LayoutPool;
11 
15 class Structure
16 {
20  protected $layoutPool;
21 
27  public function __construct(LayoutPool $layoutPool)
28  {
29  $this->layoutPool = $layoutPool;
30  }
31 
38  public function generate(UiComponentInterface $component)
39  {
41  if (!$layoutDefinition = $component->getData('layout')) {
42  $layoutDefinition = ['type' => 'generic'];
43  }
44  $layout = $this->layoutPool->create($layoutDefinition['type'], $layoutDefinition);
45 
46  return $layout->build($component);
47  }
48 }