PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.16.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.16.0
2.16.0 2.15.0 2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 All 83 releases
← All changes | includes/blocks/content-timeline/block.php +95 -148 2.13.1 → 2.16.0 View file →
@@ -27,65 +27,73 @@
27 27 $css_generator->add_class_styles(
28 28 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-icon-maker svg',
29 29 $this->get_content_timeline_icon_css( $attributes ),
30 30 $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
31 - $this->get_content_timeline_icon_css( $attributes, 'Mobile' )
31 + $this->get_content_timeline_icon_css( $attributes, 'Mobile' ),
32 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_css( $attributes, $device ); } )
32 33 );
33 34 $css_generator->add_class_styles(
34 35 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon .ablocks-icon-wrap',
35 36 $this->get_content_timeline_icon_background_css( $attributes ),
36 37 $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
37 - $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' )
38 + $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' ),
39 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_background_css( $attributes, $device ); } )
38 40 );
39 41 $css_generator->add_class_styles(
40 42 '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
41 43 $this->get_content_timeline_connector_css( $attributes ),
42 44 $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
43 - $this->get_content_timeline_connector_css( $attributes, 'Mobile' )
45 + $this->get_content_timeline_connector_css( $attributes, 'Mobile' ),
46 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_connector_css( $attributes, $device ); } )
44 47 );
45 48 $css_generator->add_class_styles(
46 49 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
47 50 $this->get_content_timeline_item_gap_css( $attributes ),
48 51 $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
49 - $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' )
52 + $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' ),
53 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_item_gap_css( $attributes, $device ); } )
50 54 );
51 55 $css_generator->add_class_styles(
56 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap',
57 + $this->get_content_timeline_horizontal_gap_css( $attributes ),
58 + $this->get_content_timeline_horizontal_gap_css( $attributes, 'Tablet' ),
59 + $this->get_content_timeline_horizontal_gap_css( $attributes, 'Mobile' ),
60 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_horizontal_gap_css( $attributes, $device ); } )
61 + );
62 + $css_generator->add_class_styles(
52 63 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
53 64 $this->get_content_timeline_content_css( $attributes ),
54 65 $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
55 - $this->get_content_timeline_content_css( $attributes, 'Mobile' )
66 + $this->get_content_timeline_content_css( $attributes, 'Mobile' ),
67 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_content_css( $attributes, $device ); } )
56 68 );
57 69 $css_generator->add_class_styles(
58 70 '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
59 71 $this->get_content_timeline_content_background_css( $attributes ),
60 72 $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
61 - $this->get_content_timeline_content_background_css( $attributes, 'Mobile' )
73 + $this->get_content_timeline_content_background_css( $attributes, 'Mobile' ),
74 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_content_background_css( $attributes, $device ); } )
62 75 );
63 76 $css_generator->add_class_styles(
64 77 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
65 78 $this->get_content_timeline_connector_alignment_css( $attributes ),
66 79 $this->get_content_timeline_connector_alignment_css( $attributes, 'Tablet' ),
67 - $this->get_content_timeline_connector_alignment_css( $attributes, 'Mobile' )
80 + $this->get_content_timeline_connector_alignment_css( $attributes, 'Mobile' ),
81 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_connector_alignment_css( $attributes, $device ); } )
68 82 );
69 83 $css_generator->add_class_styles(
70 84 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
71 85 $this->get_content_timeline_date_alignment_css( $attributes ),
72 86 $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
73 - $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' )
87 + $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' ),
88 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_alignment_css( $attributes, $device ); } )
74 89 );
75 - // Conditional CSS generation based on arrowAlignment
76 -
77 90 $css_generator->add_class_styles(
78 - '{{WRAPPER}} .ablocks-block-content-timeline-child--line-center .ablocks-block-content-timeline-child__arrow',
79 - $this->get_content_timeline_arrow_css( $attributes ),
80 - $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
81 - $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
82 - );
83 - $css_generator->add_class_styles(
84 91 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
85 92 $this->get_content_timeline_date_css( $attributes ),
86 93 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
87 - $this->get_content_timeline_date_css( $attributes, 'Mobile' )
94 + $this->get_content_timeline_date_css( $attributes, 'Mobile' ),
95 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_css( $attributes, $device ); } )
88 96 );
89 97 $css_generator->add_class_styles(
90 98 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
91 99 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
@@ -97,27 +105,24 @@
97 105 $css_generator->add_class_styles(
98 106 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
99 107 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
100 108 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
101 - $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' )
109 + $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' ),
110 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_center_css( $attributes, $device ); } )
102 111 );
103 112 $css_generator->add_class_styles(
104 113 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
105 114 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
106 115 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
107 - $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' )
116 + $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' ),
117 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_left_right_css( $attributes, $device ); } )
108 118 );
109 119 $css_generator->add_class_styles(
110 - '{{WRAPPER}} .ablocks-block-content-timeline--left .ablocks-block-content-timeline__line,.ablocks-block-content-timeline--right .ablocks-block-content-timeline__line',
111 - $this->get_content_timeline_show_date_left_right_line_css( $attributes, '' ),
112 - $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Tablet' ),
113 - $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Mobile' )
114 - );
115 - $css_generator->add_class_styles(
116 120 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
117 121 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
118 122 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
119 - $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' )
123 + $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' ),
124 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_mobile_css( $attributes, $device ); } )
120 125 );
121 126
122 127 return $css_generator->generate_css();
123 128 }
@@ -128,65 +133,73 @@
128 133 $css_generator->add_class_styles(
129 134 '{{WRAPPER}} .ablocks-icon-maker svg',
130 135 $this->get_content_timeline_icon_css( $attributes ),
131 136 $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
132 - $this->get_content_timeline_icon_css( $attributes, 'Mobile' )
137 + $this->get_content_timeline_icon_css( $attributes, 'Mobile' ),
138 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_css( $attributes, $device ); } )
133 139 );
134 140 $css_generator->add_class_styles(
135 141 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
136 142 $this->get_content_timeline_icon_background_css( $attributes ),
137 143 $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
138 - $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' )
144 + $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' ),
145 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_background_css( $attributes, $device ); } )
139 146 );
140 147 $css_generator->add_class_styles(
141 148 '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
142 149 $this->get_content_timeline_connector_css( $attributes ),
143 150 $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
144 - $this->get_content_timeline_connector_css( $attributes, 'Mobile' )
151 + $this->get_content_timeline_connector_css( $attributes, 'Mobile' ),
152 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_connector_css( $attributes, $device ); } )
145 153 );
146 154 $css_generator->add_class_styles(
147 155 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
148 156 $this->get_content_timeline_item_gap_css( $attributes ),
149 157 $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
150 - $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' )
158 + $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' ),
159 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_item_gap_css( $attributes, $device ); } )
151 160 );
152 161 $css_generator->add_class_styles(
162 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap',
163 + $this->get_content_timeline_horizontal_gap_css( $attributes ),
164 + $this->get_content_timeline_horizontal_gap_css( $attributes, 'Tablet' ),
165 + $this->get_content_timeline_horizontal_gap_css( $attributes, 'Mobile' ),
166 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_horizontal_gap_css( $attributes, $device ); } )
167 + );
168 + $css_generator->add_class_styles(
153 169 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
154 170 $this->get_content_timeline_content_css( $attributes ),
155 171 $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
156 - $this->get_content_timeline_content_css( $attributes, 'Mobile' )
172 + $this->get_content_timeline_content_css( $attributes, 'Mobile' ),
173 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_content_css( $attributes, $device ); } )
157 174 );
158 175 $css_generator->add_class_styles(
159 176 '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
160 177 $this->get_content_timeline_content_background_css( $attributes ),
161 178 $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
162 - $this->get_content_timeline_content_background_css( $attributes, 'Mobile' )
179 + $this->get_content_timeline_content_background_css( $attributes, 'Mobile' ),
180 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_content_background_css( $attributes, $device ); } )
163 181 );
164 182 $css_generator->add_class_styles(
165 183 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
166 184 $this->get_content_timeline_connector_alignment_css( $attributes ),
167 185 $this->get_content_timeline_connector_alignment_css( $attributes, 'Tablet' ),
168 - $this->get_content_timeline_connector_alignment_css( $attributes, 'Mobile' )
186 + $this->get_content_timeline_connector_alignment_css( $attributes, 'Mobile' ),
187 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_connector_alignment_css( $attributes, $device ); } )
169 188 );
170 189 $css_generator->add_class_styles(
171 190 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
172 191 $this->get_content_timeline_date_alignment_css( $attributes ),
173 192 $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
174 - $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' )
193 + $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' ),
194 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_alignment_css( $attributes, $device ); } )
175 195 );
176 - // Conditional CSS generation based on arrowAlignment
177 -
178 - $css_generator->add_class_styles(
179 - '{{WRAPPER}} .ablocks-block-content-timeline-child--line-center .ablocks-block-content-timeline-child__arrow',
180 - $this->get_content_timeline_arrow_css( $attributes ),
181 - $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
182 - $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
183 - );
184 196 $css_generator->add_class_styles(
185 197 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
186 198 $this->get_content_timeline_date_css( $attributes ),
187 199 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
188 - $this->get_content_timeline_date_css( $attributes, 'Mobile' )
200 + $this->get_content_timeline_date_css( $attributes, 'Mobile' ),
201 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_css( $attributes, $device ); } )
189 202 );
190 203 $css_generator->add_class_styles(
191 204 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
192 205 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
@@ -198,27 +211,24 @@
198 211 $css_generator->add_class_styles(
199 212 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
200 213 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
201 214 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
202 - $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' )
215 + $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' ),
216 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_center_css( $attributes, $device ); } )
203 217 );
204 218 $css_generator->add_class_styles(
205 219 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
206 220 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
207 221 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
208 - $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' )
222 + $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' ),
223 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_left_right_css( $attributes, $device ); } )
209 224 );
210 225 $css_generator->add_class_styles(
211 - '{{WRAPPER}} .ablocks-block-content-timeline--left .ablocks-block-content-timeline__line,.ablocks-block-content-timeline--right .ablocks-block-content-timeline__line',
212 - $this->get_content_timeline_show_date_left_right_line_css( $attributes, '' ),
213 - $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Tablet' ),
214 - $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Mobile' )
215 - );
216 - $css_generator->add_class_styles(
217 226 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
218 227 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
219 228 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
220 - $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' )
229 + $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' ),
230 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_mobile_css( $attributes, $device ); } )
221 231 );
222 232
223 233 return $css_generator->generate_css();
224 234 }
@@ -227,8 +237,29 @@
227 237 return $this->build_css_v2( $attributes );
228 238 }
229 239 return $this->build_css_v1( $attributes );
230 240 }
241 + // Top / Bottom content positions lay the timeline out horizontally.
242 + public function is_horizontal_timeline( $attributes ) {
243 + return in_array( $attributes['contentPosition'] ?? '', [ 'top', 'bottom' ], true );
244 + }
245 +
246 + public function get_content_timeline_horizontal_gap_css( $attributes, $device = '' ) {
247 + if ( ! $this->is_horizontal_timeline( $attributes ) ) {
248 + return [];
249 + }
250 + return Range::get_css([
251 + 'attributeValue' => $attributes['itemGap'],
252 + 'attribute_object_key' => 'value',
253 + 'defaultValue' => 10,
254 + 'isResponsive' => true,
255 + 'hasUnit' => true,
256 + 'unitDefaultValue' => 'px',
257 + 'property' => 'gap',
258 + 'device' => $device,
259 + ]);
260 + }
261 +
231 262 public function get_content_timeline_show_date_mobile_css( $attributes, $device = '' ) {
232 263 $css = [];
233 264 if ( $device === '' || $device === 'Tablet' ) {
234 265 $css['display'] = 'none';
@@ -259,9 +290,9 @@
259 290 public function get_content_timeline_show_date_left_right_css( $attribute, $device ) {
260 291 $css = [];
261 292 $showDateKey = $device ? "showDate{$device}" : 'showDate';
262 293 $showDate = $attribute[ $showDateKey ] ?? null;
263 - $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right' ], true );
294 + $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right', 'top', 'bottom' ], true );
264 295
265 296 if ( $isLeftOrRight ) {
266 297 if ( $device !== 'Mobile' ) {
267 298 $css['display'] = $showDate ? 'block !important' : 'none !important';
@@ -275,39 +306,8 @@
275 306 }
276 307
277 308 return $css;
278 309 }
279 - public function get_content_timeline_show_date_left_right_line_css( $attribute, $device ) {
280 - $css = [];
281 - $showDate = $attribute[ "showDate{$device}" ] ?? null;
282 - if ( $device === 'Mobile' ) {
283 - // Specific case for mobile content position left/right without date
284 - if ( $attribute['contentPosition'] === 'left' ) {
285 - $css['left'] = 'calc(35px / 2) !important'; // fallback for left without date
286 - } elseif ( $attribute['contentPosition'] === 'right' ) {
287 - $css['right'] = 'calc(35px / 2) !important'; // fallback for right without date
288 - }
289 - } elseif ( $device ) {
290 - // Non-mobile styles (if needed)
291 - if ( $attribute['contentPosition'] === 'left' ) {
292 - $css['left'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
293 - $css['right'] = 'auto !important';
294 - } elseif ( $attribute['contentPosition'] === 'right' ) {
295 - $css['right'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
296 - $css['left'] = 'auto !important';
297 - }
298 - } else {
299 - if ( $attribute['contentPosition'] === 'left' ) {
300 - $css['left'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
301 - $css['right'] = 'auto !important';
302 - } elseif ( $attribute['contentPosition'] === 'right' ) {
303 - $css['right'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
304 - $css['left'] = 'auto !important';
305 - }
306 - }//end if
307 -
308 - return $css;
309 - }
310 310 public function get_content_timeline_icon_css( $attributes, $device = '' ) {
311 311 $css = [];
312 312 return array_merge(
313 313 [ 'fill' => Color::get_css( isset( $attributes['iconColor'] ) ? $attributes['iconColor'] : '' ) ],
@@ -361,33 +361,17 @@
361 361 'attribute_object_key' => 'value',
362 362 'defaultValue' => 3,
363 363 'property' => 'width',
364 364 ]),
365 - Range::get_css([
366 - 'attributeValue' => $attributes['lineLeft'],
367 - 'attribute_object_key' => 'value',
368 - 'isResponsive' => true,
369 - 'hasUnit' => true,
370 - 'defaultValue' => 0,
371 - 'unitDefaultValue' => 'px',
372 - 'property' => 'margin-left',
373 - 'device' => $device,
374 - ]),
375 - Range::get_css([
376 - 'attributeValue' => $attributes['lineRight'],
377 - 'attribute_object_key' => 'value',
378 - 'isResponsive' => true,
379 - 'hasUnit' => true,
380 - 'defaultValue' => 0,
381 - 'unitDefaultValue' => 'px',
382 - 'property' => 'margin-right',
383 - 'device' => $device,
384 - ]),
385 365 );
386 366 }
387 367
388 368 public function get_content_timeline_item_gap_css( $attributes, $device = '' ) {
389 - $css = [];
369 + $icon_size_css = [ '--ablocks-content-timeline-icon-size' => ( ! empty( $attributes['iconBackgroundSize'] ) ? $attributes['iconBackgroundSize'] : 48 ) . 'px' ];
370 + if ( $this->is_horizontal_timeline( $attributes ) ) {
371 + return $icon_size_css;
372 + }
373 + $css = '' === $device ? $icon_size_css : [];
390 374 return array_merge(
391 375 Range::get_css([
392 376 'attributeValue' => $attributes['itemGap'],
393 377 'attribute_object_key' => 'value',
@@ -421,51 +405,8 @@
421 405 isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
422 406 }
423 407 return $css;
424 408 }
425 - // public function get_content_timeline_arrow_css( $attributes, $device = '' ) {
426 - // $css = [];
427 - // $arrowAlignment = $attributes['arrowAlignment'] ?? '';
428 - // $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
429 -
430 - // if ( $arrowAlignment === 'top' ) {
431 - // $css['height'] = '0px';
432 - // $css['top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
433 - // } elseif ( $arrowAlignment === 'bottom' ) {
434 - // $css['height'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
435 - // $css['bottom'] = '0';
436 - // }
437 -
438 - // return $css;
439 - // }
440 -
441 - public function get_content_timeline_arrow_css( $attributes, $device = '' ) {
442 - $css = [];
443 - $arrowAlignment = $attributes['arrowAlignment'] ?? '';
444 - $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
445 -
446 - // Existing logic + updated styles
447 - if ( $arrowAlignment === 'top' ) {
448 - $css['height'] = '35px';
449 - $css['top'] = '10%';
450 - $css['transform'] = 'translateY(-50%)';
451 - $css['-webkit-transform'] = 'translateY(-50%)';
452 -
453 - } elseif ( $arrowAlignment === 'bottom' ) {
454 - $css['height'] = '35px';
455 - $css['top'] = '90%';
456 - $css['transform'] = 'translateY(-50%)';
457 - $css['-webkit-transform'] = 'translateY(-50%)';
458 -
459 - } elseif ( $arrowAlignment === 'centre' ) {
460 - $css['height'] = '35px';
461 - $css['top'] = '50%';
462 - $css['transform'] = 'translateY(-50%)';
463 - $css['-webkit-transform'] = 'translateY(-50%)';
464 - }
465 -
466 - return $css;
467 - }
468 409 public function get_content_timeline_connector_alignment_css( $attributes, $device = '' ) {
469 410 $css = [];
470 411 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
471 412
@@ -480,8 +421,14 @@
480 421 return $css;
481 422 }
482 423 public function get_content_timeline_date_alignment_css( $attributes, $device = '' ) {
483 424 $css = [];
425 + if ( $this->is_horizontal_timeline( $attributes ) ) {
426 + return [
427 + 'align-self' => 'stretch',
428 + 'text-align' => ! empty( $attributes['dateAlign'] ) ? $attributes['dateAlign'] : 'left',
429 + ];
430 + }
484 431
485 432 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
486 433 $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
487 434