Conditions | 3 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function preprocessHasSettings($content) { |
||
12 | if (array_key_exists(config('storyblok.settings_field'), $content)) { // TODO set key in config |
||
13 | $this->_settings = collect($content[config('storyblok.settings_field')])->keyBy(function($setting) { |
||
14 | return Str::slug($setting['component'], '_'); |
||
15 | })->map(function ($setting) { |
||
16 | $settings = collect(array_diff_key($setting, array_flip(['_editable', '_uid', 'component']))) |
||
|
|||
17 | ->map(function($setting) { |
||
18 | if ($this->isCommaSeparatedList($setting)) { |
||
19 | return $this->isCommaSeparatedList($setting); |
||
20 | } |
||
21 | |||
22 | return $setting; |
||
23 | }); |
||
24 | |||
25 | return $settings; |
||
26 | }); |
||
27 | } |
||
28 | |||
29 | // remove the processed item for future items |
||
30 | unset($content[config('storyblok.settings_field')]); |
||
31 | |||
32 | return $content; |
||
33 | } |
||
56 | } |