-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
Copy pathLayoutInterface.php
308 lines (274 loc) · 6.87 KB
/
LayoutInterface.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\View;
/**
* Interface LayoutInterface
* @api
* @since 100.0.2
*/
interface LayoutInterface
{
/**
* Retrieve the layout processor
*
* @return Layout\ProcessorInterface
*/
public function getUpdate();
/**
* Layout xml generation
*
* @return LayoutInterface
*/
public function generateXml();
/**
* Create structure of elements from the loaded XML configuration
*
* @return void
*/
public function generateElements();
/**
* Find an element in layout, render it and return string with its output
*
* @param string $name
* @param bool $useCache
* @return string
*/
public function renderElement($name, $useCache = true);
/**
* Add an element to output
*
* @param string $name
* @return LayoutInterface
*/
public function addOutputElement($name);
/**
* Get all blocks marked for output
*
* @return string
*/
public function getOutput();
/**
* Check if element exists in layout structure
*
* @param string $name
* @return bool
*/
public function hasElement($name);
/**
* Remove block from registry
*
* @param string $name
* @return LayoutInterface
*/
public function unsetElement($name);
/**
* Retrieve all blocks from registry as array
*
* @return array
*/
public function getAllBlocks();
/**
* Get block object by name
*
* @param string $name
* @return Element\BlockInterface|bool
*/
public function getBlock($name);
/**
* Get child block if exists
*
* @param string $parentName
* @param string $alias
* @return null
*/
public function getChildBlock($parentName, $alias);
/**
* Set child element into layout structure
*
* @param string $parentName
* @param string $elementName
* @param string $alias
* @return LayoutInterface
*/
public function setChild($parentName, $elementName, $alias);
/**
* Reorder a child of a specified element
*
* If $offsetOrSibling is null, it will put the element to the end
* If $offsetOrSibling is numeric (integer) value, it will put the element after/before specified position
* Otherwise -- after/before specified sibling
*
* @param string $parentName
* @param string $childName
* @param string|int|null $offsetOrSibling
* @param bool $after
* @return void
*/
public function reorderChild($parentName, $childName, $offsetOrSibling, $after = true);
/**
* Remove child element from parent
*
* @param string $parentName
* @param string $alias
* @return LayoutInterface
*/
public function unsetChild($parentName, $alias);
/**
* Get list of child names
*
* @param string $parentName
* @return array
*/
public function getChildNames($parentName);
/**
* Get list of child blocks
*
* Returns associative array of <alias> => <block instance>
*
* @param string $parentName
* @return array
*/
public function getChildBlocks($parentName);
/**
* Get child name by alias
*
* @param string $parentName
* @param string $alias
* @return bool|string
*/
public function getChildName($parentName, $alias);
/**
* Add element to parent group
*
* @param string $blockName
* @param string $parentGroupName
* @return bool
*/
public function addToParentGroup($blockName, $parentGroupName);
/**
* Get element names for specified group
*
* @param string $blockName
* @param string $groupName
* @return array
*/
public function getGroupChildNames($blockName, $groupName);
/**
* Gets parent name of an element with specified name
*
* @param string $childName
* @return bool|string
*/
public function getParentName($childName);
/**
* Block Factory
*
* @param string $type
* @param string $name
* @param array $arguments
* @return Element\BlockInterface
*/
public function createBlock($type, $name = '', array $arguments = []);
/**
* Add a block to registry, create new object if needed
*
* @param string|\Magento\Framework\View\Element\AbstractBlock $block
* @param string $name
* @param string $parent
* @param string $alias
* @return Element\BlockInterface
*/
public function addBlock($block, $name = '', $parent = '', $alias = '');
/**
* Insert container into layout structure
*
* @param string $name
* @param string $label
* @param array $options
* @param string $parent
* @param string $alias
* @return void
*/
public function addContainer($name, $label, array $options = [], $parent = '', $alias = '');
/**
* Rename element in layout and layout structure
*
* @param string $oldName
* @param string $newName
* @return bool
*/
public function renameElement($oldName, $newName);
/**
* Get element alias by name
*
* @param string $name
* @return bool|string
*/
public function getElementAlias($name);
/**
* Remove an element from output
*
* @param string $name
* @return LayoutInterface
*/
public function removeOutputElement($name);
/**
* Retrieve messages block
*
* @return \Magento\Framework\View\Element\Messages
*/
public function getMessagesBlock();
/**
* Get block singleton
*
* @param string $type
* @return Element\BlockInterface
*/
public function getBlockSingleton($type);
/**
* Get property value of an element
*
* @param string $name
* @param string $attribute
* @return mixed
*/
public function getElementProperty($name, $attribute);
/**
* Whether specified element is a block
*
* @param string $name
* @return bool
*/
public function isBlock($name);
/**
* Checks if element with specified name is container
*
* @param string $name
* @return bool
*/
public function isContainer($name);
/**
* Whether the specified element may be manipulated externally
*
* @param string $name
* @return bool
*/
public function isManipulationAllowed($name);
/**
* Save block in blocks registry
*
* @param string $name
* @param Element\BlockInterface $block
* @return LayoutInterface
*/
public function setBlock($name, $block);
/**
* Check is exists non-cacheable layout elements
*
* @return bool
*/
public function isCacheable();
}