-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
Copy pathStructure.php
48 lines (43 loc) · 1.13 KB
/
Structure.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View\Layout\Generator;
use Magento\Framework\View\Layout\Pool as LayoutPool;
use Magento\Framework\View\Element\UiComponentInterface;
use Magento\Framework\View\Element\UiComponent\LayoutInterface;
/**
* Class Structure
*/
class Structure
{
/**
* @var LayoutPool
*/
protected $layoutPool;
/**
* Constructor
*
* @param LayoutPool $layoutPool
*/
public function __construct(LayoutPool $layoutPool)
{
$this->layoutPool = $layoutPool;
}
/**
* Build component structure and retrieve
*
* @param UiComponentInterface $component
* @return array
*/
public function generate(UiComponentInterface $component)
{
/** @var LayoutInterface $layout */
if (!$layoutDefinition = $component->getData('layout')) {
$layoutDefinition = ['type' => 'generic'];
}
$layout = $this->layoutPool->create($layoutDefinition['type'], $layoutDefinition);
return $layout->build($component);
}
}