PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.2
YayMail – WooCommerce Email Customizer v4.4.2
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / Elements / ImageList.php

ImageList.php in YayMail – WooCommerce Email Customizer 4.4.2, at src/Elements/ImageList.php

193 lines 10.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace YayMail\Elements;
3
4 use YayMail\Abstracts\BaseElement;
5 use YayMail\Utils\SingletonTrait;
6 /**
7 * ImageList Elements
8 */
9 class ImageList extends BaseElement {
10
11 use SingletonTrait;
12
13 protected static $type = 'image_list';
14
15 public $available_email_ids = [ YAYMAIL_ALL_EMAILS ];
16
17 public static function get_data( $attributes = [] ) {
18 $src = esc_url( YAYMAIL_PLUGIN_URL . 'assets/images/default-photo.png' );
19 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 20 20">
20 <g>
21 <path d="M17.49,6.25v11.31H2.5V6.25h14.99M17.99,4.81H2c-.55,0-1,.43-1,.96v12.27c0,.53.45.96,1,.96h15.99c.55,0,1-.43,1-.96V5.77c0-.53-.45-.96-1-.96h0Z"/>
22 <path d="M16.63,4.38H3.32c-.41,0-.75-.32-.75-.72s.34-.72.75-.72h13.31c.41,0,.75.32.75.72s-.34.72-.75.72Z"/>
23 <path d="M14.87,2.44H5.25c-.41,0-.75-.32-.75-.72s.34-.72.75-.72h9.62c.41,0,.75.32.75.72s-.34.72-.75.72Z"/>
24 </g>
25 <path d="M12.23,15.84c-.65,0-1.3-.27-1.75-.78l-2.59-2.93c-.28-.32-.78-.36-1.11-.1l-4.36,3.46c-.32.25-.79.21-1.05-.1-.26-.31-.22-.76.1-1.01l4.36-3.46c.96-.76,2.4-.64,3.21.27l2.59,2.93c.27.3.74.36,1.07.12l5.11-3.58c.33-.23.8-.16,1.05.16.24.32.17.77-.16,1.01l-5.11,3.58c-.4.28-.88.42-1.35.42Z"/>
26 <path d="M13.16,10.98c-1.06,0-1.93-.83-1.93-1.85s.87-1.85,1.93-1.85,1.93.83,1.93,1.85-.87,1.85-1.93,1.85ZM13.16,8.71c-.24,0-.43.19-.43.41s.19.41.43.41.43-.19.43-.41-.19-.41-.43-.41Z"/>
27 </svg>';
28
29 return [
30 'id' => uniqid(),
31 'type' => self::$type,
32 'name' => __( 'Image List', 'yaymail' ),
33 'icon' => self::$icon,
34 'group' => 'basic',
35 'available' => true,
36 'position' => 110,
37 'data' => [
38 'container_group_definition' => [
39 'component' => 'GroupDefinition',
40 'title' => __( 'Container settings', 'yaymail' ),
41 'description' => __( 'Handle container layout settings', 'yaymail' ),
42 ],
43 'background_color' => [
44 'value_path' => 'background_color',
45 'component' => 'Color',
46 'title' => __( 'Background color', 'yaymail' ),
47 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
48 'type' => 'style',
49 ],
50 'number_column' => [
51 'value_path' => 'number_column',
52 'component' => 'NumberColumn',
53 'title' => __( 'Number of columns:', 'yaymail' ),
54 'default_value' => isset( $attributes['number_column'] ) ? $attributes['number_column'] : 3,
55 'type' => 'content',
56 ],
57 'column_breaker' => [
58 'component' => 'LineBreaker',
59 ],
60 'column_settings' => [
61 'component' => 'GroupDefinition',
62 'title' => __( 'Column settings', 'yaymail' ),
63 'description' => __( 'Handle column settings', 'yaymail' ),
64 ],
65 'image_list' => [
66 'value_path' => 'image_list',
67 'component' => 'ImageList',
68 'default_value' => [
69 'column_1' => [
70 'align' => [
71 'value' => isset( $attributes['column_1']['align'] ) ? $attributes['column_1']['align'] : 'center',
72 'type' => 'style',
73 ],
74 'padding' => [
75 'value' => isset( $attributes['column_1']['padding'] ) ? $attributes['column_1']['padding'] : [
76 'top' => '10',
77 'right' => '10',
78 'bottom' => '10',
79 'left' => '50',
80 ],
81 'type' => 'style',
82 ],
83 'image' => [
84 'value' => isset( $attributes['column_1']['image'] ) ? $attributes['column_1']['image'] : $src,
85 'type' => 'content',
86 ],
87 'full_width' => [
88 'value' => isset( $attributes['column_1']['full_width'] ) ? $attributes['column_1']['full_width'] : false,
89 'type' => 'style',
90 ],
91 'width' => [
92 'value' => isset( $attributes['column_1']['width'] ) ? $attributes['column_1']['width'] : '100',
93 'type' => 'style',
94 ],
95 'background_color' => [
96 'value' => isset( $attributes['column_1']['background_color'] ) ? $attributes['column_1']['background_color'] : '#fff',
97 'type' => 'style',
98 ],
99 'url' => [
100 'value' => isset( $attributes['column_1']['url'] ) ? $attributes['column_1']['url'] : '#',
101 'type' => 'content',
102 ],
103 'alt' => [
104 'value' => isset( $attributes['column_1']['alt'] ) ? $attributes['column_1']['alt'] : '',
105 'type' => 'content',
106 ],
107 ],
108 'column_2' => [
109 'align' => [
110 'value' => isset( $attributes['column_2']['align'] ) ? $attributes['column_2']['align'] : 'center',
111 'type' => 'style',
112 ],
113 'padding' => [
114 'value' => isset( $attributes['column_2']['padding'] ) ? $attributes['column_2']['padding'] : [
115 'top' => '10',
116 'right' => '10',
117 'bottom' => '10',
118 'left' => '50',
119 ],
120 'type' => 'style',
121 ],
122 'image' => [
123 'value' => isset( $attributes['column_2']['image'] ) ? $attributes['column_2']['image'] : $src,
124 'type' => 'content',
125 ],
126 'full_width' => [
127 'value' => isset( $attributes['column_2']['full_width'] ) ? $attributes['column_2']['full_width'] : false,
128 'type' => 'style',
129 ],
130 'width' => [
131 'value' => isset( $attributes['column_2']['width'] ) ? $attributes['column_2']['width'] : '100',
132 'type' => 'style',
133 ],
134 'background_color' => [
135 'value' => isset( $attributes['column_2']['background_color'] ) ? $attributes['column_2']['background_color'] : '#fff',
136 'type' => 'style',
137 ],
138 'url' => [
139 'value' => isset( $attributes['column_2']['url'] ) ? $attributes['column_2']['url'] : '#',
140 'type' => 'content',
141 ],
142 'alt' => [
143 'value' => isset( $attributes['column_2']['alt'] ) ? $attributes['column_2']['alt'] : '',
144 'type' => 'content',
145 ],
146 ],
147 'column_3' => [
148 'align' => [
149 'value' => isset( $attributes['column_3']['align'] ) ? $attributes['column_3']['align'] : 'center',
150 'type' => 'style',
151 ],
152 'padding' => [
153 'value' => isset( $attributes['column_3']['padding'] ) ? $attributes['column_3']['padding'] : [
154 'top' => '10',
155 'right' => '10',
156 'bottom' => '10',
157 'left' => '50',
158 ],
159 'type' => 'style',
160 ],
161 'image' => [
162 'value' => isset( $attributes['column_3']['image'] ) ? $attributes['column_3']['image'] : $src,
163 'type' => 'content',
164 ],
165 'full_width' => [
166 'value' => isset( $attributes['column_3']['full_width'] ) ? $attributes['column_3']['full_width'] : false,
167 'type' => 'style',
168 ],
169 'width' => [
170 'value' => isset( $attributes['column_3']['width'] ) ? $attributes['column_3']['width'] : '100',
171 'type' => 'style',
172 ],
173 'background_color' => [
174 'value' => isset( $attributes['column_3']['background_color'] ) ? $attributes['column_3']['background_color'] : '#fff',
175 'type' => 'style',
176 ],
177 'url' => [
178 'value' => isset( $attributes['column_3']['url'] ) ? $attributes['column_3']['url'] : '#',
179 'type' => 'content',
180 ],
181 'alt' => [
182 'value' => isset( $attributes['column_3']['alt'] ) ? $attributes['column_3']['alt'] : '',
183 'type' => 'content',
184 ],
185 ],
186 ],
187 ],
188
189 ],
190 ];
191 }
192 }
193