1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* StaticModule::module_script_data() |
4
|
|
|
* |
5
|
|
|
* @package MEE\Modules\StaticModule |
6
|
|
|
* @since ?? |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace MEE\Modules\StaticModule\StaticModuleTrait; |
10
|
|
|
|
11
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
12
|
|
|
die( 'Direct access forbidden.' ); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
use ET\Builder\Packages\Module\Layout\Components\MultiView\MultiViewScriptData; |
|
|
|
|
16
|
|
|
use ET\Builder\Packages\Module\Options\Element\ElementScriptData; |
|
|
|
|
17
|
|
|
|
18
|
|
|
trait ModuleScriptDataTrait { |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Set script data of used module options. |
22
|
|
|
* |
23
|
|
|
* @since ?? |
24
|
|
|
* |
25
|
|
|
* @param array $args { |
26
|
|
|
* Array of arguments. |
27
|
|
|
* |
28
|
|
|
* @type string $id Module id. |
29
|
|
|
* @type string $selector Module selector. |
30
|
|
|
* @type array $attrs Module attributes. |
31
|
|
|
* } |
32
|
|
|
*/ |
33
|
|
|
public static function module_script_data( $args ) { |
34
|
|
|
// Assign variables. |
35
|
|
|
$id = $args['id'] ?? ''; |
36
|
|
|
$name = $args['name'] ?? ''; |
37
|
|
|
$selector = $args['selector'] ?? ''; |
38
|
|
|
$attrs = $args['attrs'] ?? []; |
39
|
|
|
$store_instance = $args['storeInstance'] ?? null; |
40
|
|
|
|
41
|
|
|
// Module decoration attributes. |
42
|
|
|
$module_decoration_attrs = $attrs['module']['decoration'] ?? []; |
43
|
|
|
|
44
|
|
|
// Element Script Data Options. |
45
|
|
|
ElementScriptData::set( |
46
|
|
|
[ |
47
|
|
|
'id' => $id, |
48
|
|
|
'selector' => $selector, |
49
|
|
|
'attrs' => array_merge( |
50
|
|
|
$module_decoration_attrs, |
51
|
|
|
[ |
52
|
|
|
'link' => $args['attrs']['module']['advanced']['link'] ?? [], |
53
|
|
|
] |
54
|
|
|
), |
55
|
|
|
'storeInstance' => $store_instance, |
56
|
|
|
] |
57
|
|
|
); |
58
|
|
|
|
59
|
|
|
MultiViewScriptData::set( |
60
|
|
|
[ |
61
|
|
|
'id' => $id, |
62
|
|
|
'name' => $name, |
63
|
|
|
'hoverSelector' => $selector, |
64
|
|
|
'setContent' => [ |
65
|
|
|
[ |
66
|
|
|
'selector' => $selector . ' .example_static_module__title', |
67
|
|
|
'data' => $attrs['title']['innerContent'] ?? [], |
68
|
|
|
'valueResolver' => function( $value ) { |
69
|
|
|
return $value ?? ''; |
70
|
|
|
}, |
71
|
|
|
], |
72
|
|
|
[ |
73
|
|
|
'selector' => $selector . ' .example_static_module__content', |
74
|
|
|
'data' => $attrs['content']['innerContent'] ?? [], |
75
|
|
|
'valueResolver' => function( $value ) { |
76
|
|
|
return $value ?? ''; |
77
|
|
|
}, |
78
|
|
|
'sanitizer' => 'et_core_esc_previously', |
79
|
|
|
], |
80
|
|
|
], |
81
|
|
|
'setAttrs' => [ |
82
|
|
|
[ |
83
|
|
|
'selector' => $selector . ' .example_static_module__image img', |
84
|
|
|
'data' => [ |
85
|
|
|
'src' => $attrs['image']['innerContent'] ?? [], |
86
|
|
|
], |
87
|
|
|
'valueResolver' => function( $value ) { |
88
|
|
|
return $value['src'] ?? ''; |
89
|
|
|
}, |
90
|
|
|
'tag' => 'img', |
91
|
|
|
], |
92
|
|
|
], |
93
|
|
|
] |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths