1 | <?php |
||
2 | |||
3 | namespace Flynt; |
||
4 | |||
5 | use Flynt\Utils\Options; |
||
6 | |||
7 | add_filter( |
||
8 | 'Flynt/addComponentData', |
||
9 | 'Flynt\\addOptionsToComponent', |
||
10 | 9, |
||
11 | 2 |
||
12 | ); |
||
13 | |||
14 | function addOptionsToComponent($data, $componentName) |
||
15 | { |
||
16 | // get fields for this component |
||
17 | $options = array_reduce(array_keys(Options::OPTION_TYPES), function ($carry, $optionType) use ($componentName) { |
||
18 | return array_merge($carry, Options::get($optionType, $componentName)); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
19 | }, []); |
||
20 | // don't overwrite existing data |
||
21 | return array_merge($options, $data); |
||
22 | } |
||
23 |