Total Complexity | 6 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | trait Renderable |
||
7 | { |
||
8 | protected function views() { |
||
9 | $views[] = 'storyblok.blocks.uuid.' . $this->_uid; |
||
|
|||
10 | $segments = explode('/', rtrim(app()->make('Page')->slug(), '/')); |
||
11 | // creates an array of dot paths for each path segment |
||
12 | // site.com/this/that/them becomes: |
||
13 | // this.that.them |
||
14 | // this.that |
||
15 | // this |
||
16 | $views[] = 'storyblok.blocks.' . implode('.', $segments) . '.=' . $this->component; |
||
17 | $views[] = 'storyblok.blocks.' . implode('.', $segments) . '.' . $this->component; |
||
18 | while (count($segments) > 1) { |
||
19 | array_pop($segments); |
||
20 | $views[] = 'storyblok.blocks.' . implode('.', $segments) . '.' . $this->component; |
||
21 | } |
||
22 | |||
23 | $views[] = 'storyblok.blocks.' . $this->component; |
||
24 | $views[] = 'storyblok.blocks.default'; |
||
25 | |||
26 | return $views; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns the first matching view |
||
31 | * |
||
32 | * @return bool|mixed |
||
33 | */ |
||
34 | public function view() { |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Finds the view used to display this block’s content |
||
45 | * it will always fall back to a default view. |
||
46 | * |
||
47 | */ |
||
48 | public function render() |
||
54 | ] |
||
55 | ); |
||
57 | } |