1 | <?php |
||
26 | class BlockLayout |
||
27 | { |
||
28 | /** |
||
29 | * @var array<string,array<string,int>> |
||
30 | */ |
||
31 | private $blocks = []; |
||
32 | |||
33 | /** |
||
34 | * Adds a block definition to this layout. |
||
35 | * |
||
36 | * @param $region - The block region |
||
37 | * @param $order - The display order, smallest shows up first |
||
38 | * @param $name - The name of the block object in the container |
||
39 | * @return self provides a fluent interface |
||
40 | */ |
||
41 | 3 | public function add(string $region, int $order, string $name): self |
|
49 | |||
50 | /** |
||
51 | * Gets the blocks defined in a region. |
||
52 | * |
||
53 | * @param string $region The block region |
||
54 | * @return array<string> The block object names in display order |
||
55 | */ |
||
56 | 2 | public function get(string $region): array |
|
62 | |||
63 | /** |
||
64 | * Gets all block definitions. |
||
65 | * |
||
66 | * @return array<string,array<string>> The block definitions |
||
67 | */ |
||
68 | 1 | public function getAll(): array |
|
78 | |||
79 | /** |
||
80 | * Adds all the block definitions from another block into this one. |
||
81 | * |
||
82 | * @param $other - The other object |
||
83 | * @return self provides a fluent interface |
||
84 | */ |
||
85 | 1 | public function merge(BlockLayout $other): self |
|
95 | } |
||
96 |