PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.8.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.8.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 1.1.0 1.1.1 All 81 releases
ablocks / includes / blocks / content-timeline / block.php

block.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.8.0, at includes/blocks/content-timeline/block.php

500 lines 21.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ABlocks\Blocks\ContentTimeline;
4
5 use ABlocks\Controls\Range;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit;
9 }
10 use ABlocks\Classes\BlockBaseAbstract;
11 use ABlocks\Classes\CssGenerator;
12 use ABlocks\Classes\CssGeneratorV2;
13 use ABlocks\Controls\Dimensions;
14 use ABlocks\Controls\Typography;
15 use ABlocks\Controls\Border;
16 use ABlocks\Controls\Color;
17
18
19 class Block extends BlockBaseAbstract {
20
21 protected $block_name = 'content-timeline';
22
23 public function build_css_v1( $attributes ) {
24 $css_generator = new CssGenerator( $attributes );
25
26 // Generate and add CSS styles for different parts of the block
27 $css_generator->add_class_styles(
28 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-icon-maker svg',
29 $this->get_content_timeline_icon_css( $attributes ),
30 $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
31 $this->get_content_timeline_icon_css( $attributes, 'Mobile' )
32 );
33 $css_generator->add_class_styles(
34 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon .ablocks-icon-wrap',
35 $this->get_content_timeline_icon_background_css( $attributes ),
36 $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
37 $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' )
38 );
39 $css_generator->add_class_styles(
40 '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
41 $this->get_content_timeline_connector_css( $attributes ),
42 $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
43 $this->get_content_timeline_connector_css( $attributes, 'Mobile' )
44 );
45 $css_generator->add_class_styles(
46 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
47 $this->get_content_timeline_item_gap_css( $attributes ),
48 $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
49 $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' )
50 );
51 $css_generator->add_class_styles(
52 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
53 $this->get_content_timeline_content_css( $attributes ),
54 $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
55 $this->get_content_timeline_content_css( $attributes, 'Mobile' )
56 );
57 $css_generator->add_class_styles(
58 '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
59 $this->get_content_timeline_content_background_css( $attributes ),
60 $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
61 $this->get_content_timeline_content_background_css( $attributes, 'Mobile' )
62 );
63 // Conditional CSS generation based on arrowAlignment
64 $arrowAlignment = $attributes['arrowAlignment'] ?? 'top';
65
66 if ( $arrowAlignment === 'top' ) {
67 $css_generator->add_class_styles(
68 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-top .ablocks-block-content-timeline-child__arrow',
69 $this->get_content_timeline_arrow_css( $attributes ),
70 $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
71 $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
72 );
73 $css_generator->add_class_styles(
74 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-top .ablocks-block-content-timeline-child__date',
75 $this->get_content_timeline_date_alignment_css( $attributes ),
76 $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
77 $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' )
78 );
79 } elseif ( $arrowAlignment === 'bottom' ) {
80 $css_generator->add_class_styles(
81 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-bottom .ablocks-block-content-timeline-child__arrow',
82 $this->get_content_timeline_arrow_css( $attributes ),
83 $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
84 $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
85 );
86 $css_generator->add_class_styles(
87 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-bottom .ablocks-block-content-timeline-child__date',
88 $this->get_content_timeline_date_alignment_css( $attributes ),
89 $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
90 $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' )
91 );
92 }//end if
93 $css_generator->add_class_styles(
94 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
95 $this->get_content_timeline_date_css( $attributes ),
96 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
97 $this->get_content_timeline_date_css( $attributes, 'Mobile' )
98 );
99 $css_generator->add_class_styles(
100 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
101 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
102 );
103 $css_generator->add_class_styles(
104 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date:hover',
105 $this->get_content_timeline_date_hover_mobile_css( $attributes, 'Mobile' )
106 );
107 $css_generator->add_class_styles(
108 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
109 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
110 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
111 $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' )
112 );
113 $css_generator->add_class_styles(
114 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
115 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
116 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
117 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' )
118 );
119 $css_generator->add_class_styles(
120 '{{WRAPPER}} .ablocks-block-content-timeline--left .ablocks-block-content-timeline__line,.ablocks-block-content-timeline--right .ablocks-block-content-timeline__line',
121 $this->get_content_timeline_show_date_left_right_line_css( $attributes, '' ),
122 $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Tablet' ),
123 $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Mobile' )
124 );
125 $css_generator->add_class_styles(
126 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
127 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
128 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
129 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' )
130 );
131
132 return $css_generator->generate_css();
133 }
134 public function build_css_v2( $attributes ) {
135 $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
136
137 // Generate and add CSS styles for different parts of the block
138 $css_generator->add_class_styles(
139 '{{WRAPPER}} .ablocks-icon-maker svg',
140 $this->get_content_timeline_icon_css( $attributes ),
141 $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
142 $this->get_content_timeline_icon_css( $attributes, 'Mobile' )
143 );
144 $css_generator->add_class_styles(
145 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
146 $this->get_content_timeline_icon_background_css( $attributes ),
147 $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
148 $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' )
149 );
150 $css_generator->add_class_styles(
151 '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
152 $this->get_content_timeline_connector_css( $attributes ),
153 $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
154 $this->get_content_timeline_connector_css( $attributes, 'Mobile' )
155 );
156 $css_generator->add_class_styles(
157 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
158 $this->get_content_timeline_item_gap_css( $attributes ),
159 $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
160 $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' )
161 );
162 $css_generator->add_class_styles(
163 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
164 $this->get_content_timeline_content_css( $attributes ),
165 $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
166 $this->get_content_timeline_content_css( $attributes, 'Mobile' )
167 );
168 $css_generator->add_class_styles(
169 '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
170 $this->get_content_timeline_content_background_css( $attributes ),
171 $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
172 $this->get_content_timeline_content_background_css( $attributes, 'Mobile' )
173 );
174 // Conditional CSS generation based on arrowAlignment
175 $arrowAlignment = $attributes['arrowAlignment'] ?? 'top';
176
177 if ( $arrowAlignment === 'top' ) {
178 $css_generator->add_class_styles(
179 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-top .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 $css_generator->add_class_styles(
185 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-top .ablocks-block-content-timeline-child__date',
186 $this->get_content_timeline_date_alignment_css( $attributes ),
187 $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
188 $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' )
189 );
190 } elseif ( $arrowAlignment === 'bottom' ) {
191 $css_generator->add_class_styles(
192 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-bottom .ablocks-block-content-timeline-child__arrow',
193 $this->get_content_timeline_arrow_css( $attributes ),
194 $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
195 $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
196 );
197 $css_generator->add_class_styles(
198 '{{WRAPPER}} .ablocks-block-content-timeline-child--line-bottom .ablocks-block-content-timeline-child__date',
199 $this->get_content_timeline_date_alignment_css( $attributes ),
200 $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
201 $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' )
202 );
203 }//end if
204 $css_generator->add_class_styles(
205 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
206 $this->get_content_timeline_date_css( $attributes ),
207 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
208 $this->get_content_timeline_date_css( $attributes, 'Mobile' )
209 );
210 $css_generator->add_class_styles(
211 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
212 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
213 );
214 $css_generator->add_class_styles(
215 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date:hover',
216 $this->get_content_timeline_date_hover_mobile_css( $attributes, 'Mobile' )
217 );
218 $css_generator->add_class_styles(
219 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
220 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
221 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
222 $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' )
223 );
224 $css_generator->add_class_styles(
225 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
226 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
227 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
228 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' )
229 );
230 $css_generator->add_class_styles(
231 '{{WRAPPER}} .ablocks-block-content-timeline--left .ablocks-block-content-timeline__line,.ablocks-block-content-timeline--right .ablocks-block-content-timeline__line',
232 $this->get_content_timeline_show_date_left_right_line_css( $attributes, '' ),
233 $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Tablet' ),
234 $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Mobile' )
235 );
236 $css_generator->add_class_styles(
237 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
238 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
239 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
240 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' )
241 );
242
243 return $css_generator->generate_css();
244 }
245 public function build_css( $attributes ) {
246 if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) {
247 return $this->build_css_v2( $attributes );
248 }
249 return $this->build_css_v1( $attributes );
250 }
251 public function get_content_timeline_show_date_mobile_css( $attributes, $device = '' ) {
252 $css = [];
253 if ( $device === '' || $device === 'Tablet' ) {
254 $css['display'] = 'none';
255 }
256 if ( $device === 'Mobile' ) {
257 if ( isset( $attributes[ "showDate{$device}" ] ) && $attributes[ "showDate{$device}" ] === false ) {
258 $css['display'] = 'none';
259 } elseif ( isset( $attributes[ "showDate{$device}" ] ) && $attributes[ "showDate{$device}" ] === true ) {
260 $css['display'] = 'block';
261 }
262 }
263
264 return $css;
265 }
266 public function get_content_timeline_show_date_center_css( $attribute, $device ) {
267 $css = [];
268 $showDateKey = $device ? "showDate{$device}" : 'showDate';
269 $showDate = $attribute[ $showDateKey ] ?? null;
270 $isCentered = $attribute['contentPosition'] === 'center';
271
272 if ( $isCentered ) {
273 $css['display'] = $showDate ? 'block' : 'none';
274 }
275
276 return $css;
277 }
278
279 public function get_content_timeline_show_date_left_right_css( $attribute, $device ) {
280 $css = [];
281 $showDateKey = $device ? "showDate{$device}" : 'showDate';
282 $showDate = $attribute[ $showDateKey ] ?? null;
283 $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right' ], true );
284
285 if ( $isLeftOrRight ) {
286 if ( $device !== 'Mobile' ) {
287 $css['display'] = $showDate ? 'block !important' : 'none !important';
288 } elseif ( $device === 'Mobile' ) {
289 $css['display'] = 'none !important';
290
291 }
292 }
293 if ( $attribute['contentPosition'] === 'center' ) {
294 $css['display'] = 'block';
295 }
296
297 return $css;
298 }
299 public function get_content_timeline_show_date_left_right_line_css( $attribute, $device ) {
300 $css = [];
301 $showDate = $attribute[ "showDate{$device}" ] ?? null;
302 if ( $device === 'Mobile' ) {
303 // Specific case for mobile content position left/right without date
304 if ( $attribute['contentPosition'] === 'left' ) {
305 $css['left'] = 'calc(35px / 2) !important'; // fallback for left without date
306 } elseif ( $attribute['contentPosition'] === 'right' ) {
307 $css['right'] = 'calc(35px / 2) !important'; // fallback for right without date
308 }
309 } elseif ( $device ) {
310 // Non-mobile styles (if needed)
311 if ( $attribute['contentPosition'] === 'left' ) {
312 $css['left'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
313 $css['right'] = 'auto !important';
314 } elseif ( $attribute['contentPosition'] === 'right' ) {
315 $css['right'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
316 $css['left'] = 'auto !important';
317 }
318 } else {
319 if ( $attribute['contentPosition'] === 'left' ) {
320 $css['left'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
321 $css['right'] = 'auto !important';
322 } elseif ( $attribute['contentPosition'] === 'right' ) {
323 $css['right'] = $showDate ? 'calc(30% / 2) !important' : 'calc(61px / 2) !important';
324 $css['left'] = 'auto !important';
325 }
326 }//end if
327
328 return $css;
329 }
330 public function get_content_timeline_icon_css( $attributes, $device = '' ) {
331 $css = [];
332 return array_merge(
333 [ 'fill' => Color::get_css( isset( $attributes['iconColor'] ) ? $attributes['iconColor'] : '' ) ],
334 Range::get_css([
335 'attributeValue' => $attributes['iconSize'],
336 'attribute_object_key' => 'value',
337 'isResponsive' => true,
338 'hasUnit' => true,
339 'defaultValue' => 18,
340 'unitDefaultValue' => 'px',
341 'property' => 'width',
342 'device' => $device,
343 ]),
344 Range::get_css([
345 'attributeValue' => $attributes['iconSize'],
346 'attribute_object_key' => 'value',
347 'isResponsive' => true,
348 'hasUnit' => true,
349 'defaultValue' => 18,
350 'unitDefaultValue' => 'px',
351 'property' => 'height',
352 'device' => $device,
353 ]),
354 $css,
355 );
356 }
357
358 public function get_content_timeline_icon_background_css( $attributes, $device = '' ) {
359 return array_merge(
360 [ 'background' => Color::get_css( isset( $attributes['iconBackgroundColor'] ) ? $attributes['iconBackgroundColor'] : '' ) ],
361 Range::get_css([
362 'attributeValue' => $attributes['iconBackgroundSize'],
363 'attribute_object_key' => 'value',
364 'defaultValue' => 48,
365 'property' => 'width',
366 ]),
367 Range::get_css([
368 'attributeValue' => $attributes['iconBackgroundSize'],
369 'attribute_object_key' => 'value',
370 'defaultValue' => 48,
371 'property' => 'height',
372 ]),
373 );
374 }
375
376 public function get_content_timeline_connector_css( $attributes, $device = '' ) {
377 return array_merge(
378 [ 'background' => Color::get_css( isset( $attributes['thicknessColor'] ) ? $attributes['thicknessColor'] : '' ) ],
379 Range::get_css([
380 'attributeValue' => $attributes['thickness'],
381 'attribute_object_key' => 'value',
382 'defaultValue' => 3,
383 'property' => 'width',
384 ]),
385 Range::get_css([
386 'attributeValue' => $attributes['lineLeft'],
387 'attribute_object_key' => 'value',
388 'isResponsive' => true,
389 'hasUnit' => true,
390 'defaultValue' => 0,
391 'unitDefaultValue' => 'px',
392 'property' => 'margin-left',
393 'device' => $device,
394 ]),
395 Range::get_css([
396 'attributeValue' => $attributes['lineRight'],
397 'attribute_object_key' => 'value',
398 'isResponsive' => true,
399 'hasUnit' => true,
400 'defaultValue' => 0,
401 'unitDefaultValue' => 'px',
402 'property' => 'margin-right',
403 'device' => $device,
404 ]),
405 );
406 }
407
408 public function get_content_timeline_item_gap_css( $attributes, $device = '' ) {
409 $css = [];
410 return array_merge(
411 Range::get_css([
412 'attributeValue' => $attributes['itemGap'],
413 'attribute_object_key' => 'value',
414 'defaultValue' => 10,
415 'isResponsive' => true,
416 'hasUnit' => true,
417 'unitDefaultValue' => 'px',
418 'property' => 'margin-top',
419 'device' => $device,
420 ]),
421 $css,
422 );
423 }
424
425 public function get_content_timeline_content_css( $attributes, $device = '' ) {
426 $css = [];
427 $css['padding'] = '15px';
428 return array_merge(
429 [ 'background' => Color::get_css( isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '' ) ],
430 $css,
431 Dimensions::get_css( $attributes['contentPadding'] ?? [], 'padding', $device )
432 );
433 }
434
435 public function get_content_timeline_content_background_css( $attributes, $device = '' ) {
436 $css = [];
437 if ( ! empty( $attributes['contentBackgroundColor'] ) ) {
438 $css['border-left-color'] = Color::get_css(
439 isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
440 $css['border-right-color'] = Color::get_css(
441 isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
442 }
443 return $css;
444 }
445 public function get_content_timeline_arrow_css( $attributes, $device = '' ) {
446 $css = [];
447 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
448 $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
449
450 if ( $arrowAlignment === 'top' ) {
451 $css['height'] = '0px';
452 $css['top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
453 } elseif ( $arrowAlignment === 'bottom' ) {
454 $css['height'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
455 $css['bottom'] = '0';
456 }
457
458 return $css;
459 }
460 public function get_content_timeline_date_alignment_css( $attributes, $device = '' ) {
461 $css = [];
462
463 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
464 $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
465
466 if ( $arrowAlignment === 'top' ) {
467 $css['margin-top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 4 ) . 'px' : '0';
468 } elseif ( $arrowAlignment === 'bottom' ) {
469 $css['margin-bottom'] = $iconBackgroundSize ? ( $iconBackgroundSize / 4 ) . 'px' : '0';
470 }
471
472 return $css;
473 }
474
475 public function get_content_timeline_date_css( $attributes, $device = '' ) {
476 $typographyValueGlobal = $attributes['dateTypographyGlobal'] ? $attributes['dateTypographyGlobal'] : [];
477 return array_merge(
478 [ 'color' => Color::get_css( isset( $attributes['dateColor'] ) ? $attributes['dateColor'] : '' ) ],
479 Typography::get_css( $attributes['dateTypography'] ?? [], '', $device, $typographyValueGlobal )
480 );
481 }
482 public function get_content_timeline_date_mobile_css( $attributes, $device = '' ) {
483 $css = [];
484 if ( ! empty( $attributes['dateAlign'] ) ) {
485 $css['text-align'] = $attributes['dateAlign'];
486 }
487 return array_merge(
488 [ 'background' => Color::get_css( isset( $attributes['dateBackground'] ) ? $attributes['dateBackground'] : '' ) ],
489 $css,
490 Dimensions::get_css( $attributes['datePadding'] ?? [], 'padding', $device ),
491 Border::get_css( $attributes['dateBorder'] ?? [], '', $device )
492 );
493 }
494 public function get_content_timeline_date_hover_mobile_css( $attributes, $device = '' ) {
495 return array_merge(
496 Border::get_hover_css( $attributes['dateBorder'] ?? [], '', $device )
497 );
498 }
499 }
500