Conditions | 6 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function init() { |
||
16 | $richtextResolver = new Resolver(); |
||
17 | |||
18 | $content = []; |
||
19 | |||
20 | // Loop through all the nodes looking for a ‘blok’ nodes and convery them to |
||
21 | // the correct Block Class. All other nodes are converted to HTML |
||
22 | foreach ($this->content['content'] as $node) { |
||
23 | if ($node['type'] === 'blok' && isset($node['attrs']['body']) && is_array($node['attrs']['body'])) { |
||
24 | foreach ($node['attrs']['body'] as $blockContent) { |
||
25 | $class = $this->getChildClassName('Block', $blockContent['component']); |
||
26 | $block = new $class($blockContent, $this->block()); |
||
27 | |||
28 | $content[] = $block; |
||
29 | } |
||
30 | } else { |
||
31 | $content[] = $richtextResolver->render(["content" => [$node]]); |
||
32 | } |
||
33 | } |
||
34 | |||
35 | $this->content = collect($content); |
||
36 | } |
||
58 | } |