PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.1
YayMail – WooCommerce Email Customizer v4.4.1
4.4.6 4.4.5 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 All 57 releases
yaymail / src / Elements / OrderProgress.php

OrderProgress.php in YayMail – WooCommerce Email Customizer 4.4.1, at src/Elements/OrderProgress.php

220 lines 11.3 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 /**
8 * OrderProgress element.
9 */
10 class OrderProgress extends BaseElement {
11
12 use SingletonTrait;
13
14 protected static $type = 'order_progress';
15
16 public $available_email_ids = [ YAYMAIL_WITH_ORDER_EMAILS ];
17
18 public static function get_data( $attributes = [] ) {
19 $default_icon = esc_url( YAYMAIL_PLUGIN_URL . 'assets/images/union.png' );
20
21 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M3,2.5h14v1.75H3Z"/><path fill-rule="evenodd" d="M3.5,4.25h13v6.5h-13ZM4.25,5h11.5v5h-11.5Z"/><path d="M9.5,2.5h1v8.25h-1Z"/><path d="M4,15.5h12v.6H4Z"/><path d="M2.5,15.8a1.8,1.8 0 1,0 3.6,0a1.8,1.8 0 1,0 -3.6,0Z"/><path fill-rule="evenodd" d="M8.2,15.8a1.8,1.8 0 1,0 3.6,0a1.8,1.8 0 1,0 -3.6,0ZM9.15,15.8a.85,.85 0 1,1 1.7,0a.85,.85 0 1,1 -1.7,0Z"/><path fill-rule="evenodd" d="M13.7,15.8a1.8,1.8 0 1,0 3.6,0a1.8,1.8 0 1,0 -3.6,0ZM14.65,15.8a.85,.85 0 1,1 1.7,0a.85,.85 0 1,1 -1.7,0Z"/></svg>';
22
23 $default_steps = [
24 [
25 'title' => __( 'Ordered', 'yaymail' ),
26 'label_active_color' => '#636363',
27 'label_inactive_color' => '#71717a',
28 'image_active_url' => $default_icon,
29 'image_inactive_url' => $default_icon,
30 'image_bg_color' => '#873eff',
31 'filled_bar_icon_border_radius' => '50',
32 'filled_bar_icon_border_color_active' => '#636363',
33 'filled_bar_icon_border_color_inactive' => '#e9d5ff',
34 ],
35 [
36 'title' => __( 'Processing', 'yaymail' ),
37 'label_active_color' => '#636363',
38 'label_inactive_color' => '#71717a',
39 'image_active_url' => $default_icon,
40 'image_inactive_url' => $default_icon,
41 'image_bg_color' => '#873eff',
42 'filled_bar_icon_border_radius' => '50',
43 'filled_bar_icon_border_color_active' => '#c4b5fd',
44 'filled_bar_icon_border_color_inactive' => '#e9d5ff',
45 ],
46 [
47 'title' => __( 'Completed', 'yaymail' ),
48 'label_active_color' => '#636363',
49 'label_inactive_color' => '#71717a',
50 'image_active_url' => $default_icon,
51 'image_inactive_url' => $default_icon,
52 'image_bg_color' => '#873eff',
53 'filled_bar_icon_border_radius' => '50',
54 'filled_bar_icon_border_color_active' => '#c4b5fd',
55 'filled_bar_icon_border_color_inactive' => '#e9d5ff',
56 ],
57 ];
58
59 return [
60 'id' => uniqid(),
61 'type' => self::$type,
62 'name' => __( 'Order Progress', 'yaymail' ),
63 'icon' => self::$icon,
64 'group' => 'woocommerce',
65 'available' => true,
66 'position' => 152,
67 'status_info' => [
68 'text' => __( 'New', 'yaymail' ),
69 ],
70 'data' => [
71 'container_group_definition' => [
72 'component' => 'GroupDefinition',
73 'title' => __( 'Container settings', 'yaymail' ),
74 'description' => __( 'Handle container layout settings', 'yaymail' ),
75 ],
76 'padding' => [
77 'value_path' => 'padding',
78 'component' => 'Spacing',
79 'title' => __( 'Padding', 'yaymail' ),
80 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
81 'top' => '10',
82 'right' => '50',
83 'bottom' => '10',
84 'left' => '50',
85 ],
86 'type' => 'style',
87 ],
88 'background_color' => ElementsHelper::get_color(
89 $attributes,
90 [
91 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#ffffff',
92 ]
93 ),
94 'quick_presets' => [
95 'component' => 'OrderProgressQuickPresets',
96 'title' => __( 'Quick presets', 'yaymail' ),
97 'type' => 'style',
98 ],
99 'display_style' => [
100 'value_path' => 'display_style',
101 'component' => 'Selector',
102 'title' => __( 'Display style', 'yaymail' ),
103 'default_value' => isset( $attributes['display_style'] ) ? $attributes['display_style'] : 'step_marker',
104 'options' => [
105 [
106 'value' => 'step_marker',
107 'label' => __( 'Step marker', 'yaymail' ),
108 ],
109 [
110 'value' => 'filled_bar',
111 'label' => __( 'Filled bar', 'yaymail' ),
112 ],
113 ],
114 'type' => 'style',
115 ],
116 'content_breaker' => [
117 'component' => 'LineBreaker',
118 ],
119 'content_group_definition' => [
120 'component' => 'GroupDefinition',
121 'title' => __( 'Content settings', 'yaymail' ),
122 'description' => __( 'Handle content settings', 'yaymail' ),
123 ],
124 'current_step_index' => [
125 'value_path' => 'current_step_index',
126 'component' => 'OrderProgressCurrentStep',
127 'title' => __( 'Current step', 'yaymail' ),
128 'description' => __( 'Choose the active step.', 'yaymail' ),
129 'default_value' => isset( $attributes['current_step_index'] ) ? $attributes['current_step_index'] : 0,
130 'type' => 'content',
131 ],
132 'connector_height' => ElementsHelper::get_dimension(
133 $attributes,
134 [
135 'value_path' => 'connector_height',
136 'title' => __( 'Connector height', 'yaymail' ),
137 'default_value' => isset( $attributes['connector_height'] ) ? $attributes['connector_height'] : '4',
138 'min' => 1,
139 'max' => 10,
140 'unit' => 'px',
141 'type' => 'style',
142 ]
143 ),
144 'connector_active_color' => ElementsHelper::get_color(
145 $attributes,
146 [
147 'value_path' => 'connector_active_color',
148 'title' => __( 'Connector color (active)', 'yaymail' ),
149 'default_value' => isset( $attributes['connector_active_color'] ) ? $attributes['connector_active_color'] : '#873eff',
150 ]
151 ),
152 'connector_inactive_color' => ElementsHelper::get_color(
153 $attributes,
154 [
155 'value_path' => 'connector_inactive_color',
156 'title' => __( 'Connector color (inactive)', 'yaymail' ),
157 'default_value' => isset( $attributes['connector_inactive_color'] ) ? $attributes['connector_inactive_color'] : '#E2E6EE',
158 ]
159 ),
160 'icon_size' => ElementsHelper::get_dimension(
161 $attributes,
162 [
163 'value_path' => 'icon_size',
164 'title' => __( 'Icon size', 'yaymail' ),
165 'default_value' => isset( $attributes['icon_size'] ) ? $attributes['icon_size'] : '18',
166 'min' => 10,
167 'max' => 80,
168 'unit' => 'px',
169 'type' => 'style',
170 ]
171 ),
172 'filled_bar_icon_border_radius' => [
173 'value_path' => 'filled_bar_icon_border_radius',
174 'component' => 'OrderProgressFilledBarBorderRadius',
175 'title' => __( 'Icon border radius', 'yaymail' ),
176 'default_value' => isset( $attributes['filled_bar_icon_border_radius'] ) ? $attributes['filled_bar_icon_border_radius'] : '50',
177 'min' => 0,
178 'max' => 50,
179 'unit' => 'px',
180 'type' => 'style',
181 ],
182 'label_font_size' => ElementsHelper::get_dimension(
183 $attributes,
184 [
185 'value_path' => 'label_font_size',
186 'title' => __( 'Label font size', 'yaymail' ),
187 'default_value' => isset( $attributes['label_font_size'] ) ? $attributes['label_font_size'] : '14',
188 'min' => 8,
189 'max' => 24,
190 'unit' => 'px',
191 'type' => 'style',
192 ]
193 ),
194 'font_family' => [
195 'value_path' => 'font_family',
196 'component' => 'FontFamilySelector',
197 'title' => __( 'Label font family', 'yaymail' ),
198 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : 'Georgia, "Times New Roman", Times, serif',
199 'type' => 'style',
200 ],
201 'appearance_breaker' => [
202 'component' => 'LineBreaker',
203 ],
204 'appearance_group_definition' => [
205 'component' => 'GroupDefinition',
206 'title' => __( 'Appearance', 'yaymail' ),
207 'description' => __( 'Handle step label colors and icon background color.', 'yaymail' ),
208 ],
209 'steps' => [
210 'value_path' => 'steps',
211 'component' => 'OrderProgressSteps',
212 'title' => __( 'Steps', 'yaymail' ),
213 'default_value' => isset( $attributes['steps'] ) && is_array( $attributes['steps'] ) ? $attributes['steps'] : $default_steps,
214 'type' => 'content',
215 ],
216 ],
217 ];
218 }
219 }
220