1 | <?php |
||
21 | abstract class Block implements BlockInterface |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * BlockAssetManager that this editor block uses for asset registration |
||
26 | * |
||
27 | * @var BlockAssetManagerInterface $block_asset_manager |
||
28 | */ |
||
29 | protected $block_asset_manager; |
||
30 | |||
31 | /** |
||
32 | * @var RequestInterface $request |
||
33 | */ |
||
34 | protected $request; |
||
35 | |||
36 | /** |
||
37 | * @var array $attributes |
||
38 | */ |
||
39 | private $attributes; |
||
40 | |||
41 | /** |
||
42 | * If set to true, then the block will render its content client side |
||
43 | * If false, then the block will render its content server side using the renderBlock() method |
||
44 | * |
||
45 | * @var bool $dynamic |
||
46 | */ |
||
47 | private $dynamic = false; |
||
48 | |||
49 | /** |
||
50 | * @var string $block_type |
||
51 | */ |
||
52 | private $block_type; |
||
53 | |||
54 | /** |
||
55 | * @var array $supported_routes |
||
56 | */ |
||
57 | private $supported_routes; |
||
58 | |||
59 | |||
60 | /** |
||
61 | * Block constructor. |
||
62 | * |
||
63 | * @param BlockAssetManagerInterface $block_asset_manager |
||
64 | * @param RequestInterface $request |
||
65 | */ |
||
66 | public function __construct(BlockAssetManagerInterface $block_asset_manager, RequestInterface $request) |
||
71 | |||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | public function blockType() |
||
80 | |||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | public function namespacedBlockType() |
||
89 | |||
90 | |||
91 | /** |
||
92 | * @param string $block_type |
||
93 | */ |
||
94 | protected function setBlockType($block_type) |
||
98 | |||
99 | |||
100 | /** |
||
101 | * BlockAssetManager that this editor block uses for asset registration |
||
102 | * |
||
103 | * @return BlockAssetManagerInterface |
||
104 | */ |
||
105 | public function assetManager() |
||
109 | |||
110 | |||
111 | /** |
||
112 | * returns an array of fully qualified class names |
||
113 | * for RouteMatchSpecificationInterface objects |
||
114 | * that specify routes that the block should be loaded for. |
||
115 | * |
||
116 | * @return array |
||
117 | */ |
||
118 | public function supportedRoutes() |
||
122 | |||
123 | |||
124 | /** |
||
125 | * @param array $supported_routes |
||
126 | */ |
||
127 | protected function setSupportedRoutes(array $supported_routes) |
||
131 | |||
132 | |||
133 | /** |
||
134 | * @return array |
||
135 | */ |
||
136 | public function attributes() |
||
140 | |||
141 | |||
142 | /** |
||
143 | * @param array $attributes |
||
144 | */ |
||
145 | public function setAttributes(array $attributes) |
||
149 | |||
150 | |||
151 | /** |
||
152 | * @return bool |
||
153 | */ |
||
154 | public function isDynamic() |
||
158 | |||
159 | |||
160 | /** |
||
161 | * @param bool $dynamic |
||
162 | */ |
||
163 | public function setDynamic($dynamic = true) |
||
167 | |||
168 | |||
169 | /** |
||
170 | * Registers the Editor Block with WP core; |
||
171 | * Returns the registered block type on success, or false on failure. |
||
172 | * |
||
173 | * @return WP_Block_Type|false |
||
174 | */ |
||
175 | public function registerBlock() |
||
192 | |||
193 | |||
194 | /** |
||
195 | * @return WP_Block_Type|false The registered block type on success, or false on failure. |
||
196 | */ |
||
197 | public function unRegisterBlock() |
||
201 | |||
202 | |||
203 | |||
204 | /** |
||
205 | * @return array |
||
206 | */ |
||
207 | public function getEditorContainer() |
||
214 | |||
215 | |||
216 | /** |
||
217 | * @since $VID:$ |
||
218 | */ |
||
219 | protected function loadGraphQLRelayAutoloader() |
||
229 | } |
||
230 |