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 +476 -0 2.7.5 → 2.16.0 View file →
@@ -1,0 +1,476 @@
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 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_css( $attributes, $device ); } )
33 + );
34 + $css_generator->add_class_styles(
35 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon .ablocks-icon-wrap',
36 + $this->get_content_timeline_icon_background_css( $attributes ),
37 + $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
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 ); } )
40 + );
41 + $css_generator->add_class_styles(
42 + '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
43 + $this->get_content_timeline_connector_css( $attributes ),
44 + $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
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 ); } )
47 + );
48 + $css_generator->add_class_styles(
49 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
50 + $this->get_content_timeline_item_gap_css( $attributes ),
51 + $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
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 ); } )
54 + );
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(
63 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
64 + $this->get_content_timeline_content_css( $attributes ),
65 + $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
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 ); } )
68 + );
69 + $css_generator->add_class_styles(
70 + '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
71 + $this->get_content_timeline_content_background_css( $attributes ),
72 + $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
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 ); } )
75 + );
76 + $css_generator->add_class_styles(
77 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
78 + $this->get_content_timeline_connector_alignment_css( $attributes ),
79 + $this->get_content_timeline_connector_alignment_css( $attributes, 'Tablet' ),
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 ); } )
82 + );
83 + $css_generator->add_class_styles(
84 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
85 + $this->get_content_timeline_date_alignment_css( $attributes ),
86 + $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
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 ); } )
89 + );
90 + $css_generator->add_class_styles(
91 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
92 + $this->get_content_timeline_date_css( $attributes ),
93 + $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
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 ); } )
96 + );
97 + $css_generator->add_class_styles(
98 + '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
99 + $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
100 + );
101 + $css_generator->add_class_styles(
102 + '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date:hover',
103 + $this->get_content_timeline_date_hover_mobile_css( $attributes, 'Mobile' )
104 + );
105 + $css_generator->add_class_styles(
106 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
107 + $this->get_content_timeline_show_date_center_css( $attributes, '' ),
108 + $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
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 ); } )
111 + );
112 + $css_generator->add_class_styles(
113 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
114 + $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
115 + $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
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 ); } )
118 + );
119 + $css_generator->add_class_styles(
120 + '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
121 + $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
122 + $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
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 ); } )
125 + );
126 +
127 + return $css_generator->generate_css();
128 + }
129 + public function build_css_v2( $attributes ) {
130 + $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
131 +
132 + // Generate and add CSS styles for different parts of the block
133 + $css_generator->add_class_styles(
134 + '{{WRAPPER}} .ablocks-icon-maker svg',
135 + $this->get_content_timeline_icon_css( $attributes ),
136 + $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
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 ); } )
139 + );
140 + $css_generator->add_class_styles(
141 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
142 + $this->get_content_timeline_icon_background_css( $attributes ),
143 + $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
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 ); } )
146 + );
147 + $css_generator->add_class_styles(
148 + '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
149 + $this->get_content_timeline_connector_css( $attributes ),
150 + $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
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 ); } )
153 + );
154 + $css_generator->add_class_styles(
155 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
156 + $this->get_content_timeline_item_gap_css( $attributes ),
157 + $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
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 ); } )
160 + );
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(
169 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
170 + $this->get_content_timeline_content_css( $attributes ),
171 + $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
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 ); } )
174 + );
175 + $css_generator->add_class_styles(
176 + '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
177 + $this->get_content_timeline_content_background_css( $attributes ),
178 + $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
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 ); } )
181 + );
182 + $css_generator->add_class_styles(
183 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
184 + $this->get_content_timeline_connector_alignment_css( $attributes ),
185 + $this->get_content_timeline_connector_alignment_css( $attributes, 'Tablet' ),
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 ); } )
188 + );
189 + $css_generator->add_class_styles(
190 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
191 + $this->get_content_timeline_date_alignment_css( $attributes ),
192 + $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
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 ); } )
195 + );
196 + $css_generator->add_class_styles(
197 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
198 + $this->get_content_timeline_date_css( $attributes ),
199 + $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
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 ); } )
202 + );
203 + $css_generator->add_class_styles(
204 + '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
205 + $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
206 + );
207 + $css_generator->add_class_styles(
208 + '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date:hover',
209 + $this->get_content_timeline_date_hover_mobile_css( $attributes, 'Mobile' )
210 + );
211 + $css_generator->add_class_styles(
212 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
213 + $this->get_content_timeline_show_date_center_css( $attributes, '' ),
214 + $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
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 ); } )
217 + );
218 + $css_generator->add_class_styles(
219 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
220 + $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
221 + $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
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 ); } )
224 + );
225 + $css_generator->add_class_styles(
226 + '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
227 + $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
228 + $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
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 ); } )
231 + );
232 +
233 + return $css_generator->generate_css();
234 + }
235 + public function build_css( $attributes ) {
236 + if ( isset( $attributes['blockVersion'] ) && (int) $attributes['blockVersion'] === 2 ) {
237 + return $this->build_css_v2( $attributes );
238 + }
239 + return $this->build_css_v1( $attributes );
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 +
262 + public function get_content_timeline_show_date_mobile_css( $attributes, $device = '' ) {
263 + $css = [];
264 + if ( $device === '' || $device === 'Tablet' ) {
265 + $css['display'] = 'none';
266 + }
267 + if ( $device === 'Mobile' ) {
268 + if ( isset( $attributes[ "showDate{$device}" ] ) && $attributes[ "showDate{$device}" ] === false ) {
269 + $css['display'] = 'none';
270 + } elseif ( isset( $attributes[ "showDate{$device}" ] ) && $attributes[ "showDate{$device}" ] === true ) {
271 + $css['display'] = 'block';
272 + }
273 + }
274 +
275 + return $css;
276 + }
277 + public function get_content_timeline_show_date_center_css( $attribute, $device ) {
278 + $css = [];
279 + $showDateKey = $device ? "showDate{$device}" : 'showDate';
280 + $showDate = $attribute[ $showDateKey ] ?? null;
281 + $isCentered = $attribute['contentPosition'] === 'center';
282 +
283 + if ( $isCentered ) {
284 + $css['display'] = $showDate ? 'block' : 'none';
285 + }
286 +
287 + return $css;
288 + }
289 +
290 + public function get_content_timeline_show_date_left_right_css( $attribute, $device ) {
291 + $css = [];
292 + $showDateKey = $device ? "showDate{$device}" : 'showDate';
293 + $showDate = $attribute[ $showDateKey ] ?? null;
294 + $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right', 'top', 'bottom' ], true );
295 +
296 + if ( $isLeftOrRight ) {
297 + if ( $device !== 'Mobile' ) {
298 + $css['display'] = $showDate ? 'block !important' : 'none !important';
299 + } elseif ( $device === 'Mobile' ) {
300 + $css['display'] = 'none !important';
301 +
302 + }
303 + }
304 + if ( $attribute['contentPosition'] === 'center' ) {
305 + $css['display'] = 'block';
306 + }
307 +
308 + return $css;
309 + }
310 + public function get_content_timeline_icon_css( $attributes, $device = '' ) {
311 + $css = [];
312 + return array_merge(
313 + [ 'fill' => Color::get_css( isset( $attributes['iconColor'] ) ? $attributes['iconColor'] : '' ) ],
314 + Range::get_css([
315 + 'attributeValue' => $attributes['iconSize'],
316 + 'attribute_object_key' => 'value',
317 + 'isResponsive' => true,
318 + 'hasUnit' => true,
319 + 'defaultValue' => 18,
320 + 'unitDefaultValue' => 'px',
321 + 'property' => 'width',
322 + 'device' => $device,
323 + ]),
324 + Range::get_css([
325 + 'attributeValue' => $attributes['iconSize'],
326 + 'attribute_object_key' => 'value',
327 + 'isResponsive' => true,
328 + 'hasUnit' => true,
329 + 'defaultValue' => 18,
330 + 'unitDefaultValue' => 'px',
331 + 'property' => 'height',
332 + 'device' => $device,
333 + ]),
334 + $css,
335 + );
336 + }
337 +
338 + public function get_content_timeline_icon_background_css( $attributes, $device = '' ) {
339 + return array_merge(
340 + [ 'background' => Color::get_css( isset( $attributes['iconBackgroundColor'] ) ? $attributes['iconBackgroundColor'] : '' ) ],
341 + Range::get_css([
342 + 'attributeValue' => $attributes['iconBackgroundSize'],
343 + 'attribute_object_key' => 'value',
344 + 'defaultValue' => 48,
345 + 'property' => 'width',
346 + ]),
347 + Range::get_css([
348 + 'attributeValue' => $attributes['iconBackgroundSize'],
349 + 'attribute_object_key' => 'value',
350 + 'defaultValue' => 48,
351 + 'property' => 'height',
352 + ]),
353 + );
354 + }
355 +
356 + public function get_content_timeline_connector_css( $attributes, $device = '' ) {
357 + return array_merge(
358 + [ 'background' => Color::get_css( isset( $attributes['thicknessColor'] ) ? $attributes['thicknessColor'] : '' ) ],
359 + Range::get_css([
360 + 'attributeValue' => $attributes['thickness'],
361 + 'attribute_object_key' => 'value',
362 + 'defaultValue' => 3,
363 + 'property' => 'width',
364 + ]),
365 + );
366 + }
367 +
368 + public function get_content_timeline_item_gap_css( $attributes, $device = '' ) {
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 : [];
374 + return array_merge(
375 + Range::get_css([
376 + 'attributeValue' => $attributes['itemGap'],
377 + 'attribute_object_key' => 'value',
378 + 'defaultValue' => 10,
379 + 'isResponsive' => true,
380 + 'hasUnit' => true,
381 + 'unitDefaultValue' => 'px',
382 + 'property' => 'margin-top',
383 + 'device' => $device,
384 + ]),
385 + $css,
386 + );
387 + }
388 +
389 + public function get_content_timeline_content_css( $attributes, $device = '' ) {
390 + $css = [];
391 + $css['padding'] = '15px';
392 + return array_merge(
393 + [ 'background' => Color::get_css( isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '' ) ],
394 + $css,
395 + Dimensions::get_css( $attributes['contentPadding'] ?? [], 'padding', $device )
396 + );
397 + }
398 +
399 + public function get_content_timeline_content_background_css( $attributes, $device = '' ) {
400 + $css = [];
401 + if ( ! empty( $attributes['contentBackgroundColor'] ) ) {
402 + $css['border-left-color'] = Color::get_css(
403 + isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
404 + $css['border-right-color'] = Color::get_css(
405 + isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
406 + }
407 + return $css;
408 + }
409 + public function get_content_timeline_connector_alignment_css( $attributes, $device = '' ) {
410 + $css = [];
411 + $arrowAlignment = $attributes['arrowAlignment'] ?? '';
412 +
413 + if ( $arrowAlignment === 'top' ) {
414 + $css['align-self'] = 'flex-start';
415 + } elseif ( $arrowAlignment === 'bottom' ) {
416 + $css['align-self'] = 'flex-end';
417 + } else {
418 + $css['align-self'] = 'center';
419 + }
420 +
421 + return $css;
422 + }
423 + public function get_content_timeline_date_alignment_css( $attributes, $device = '' ) {
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 + }
431 +
432 + $arrowAlignment = $attributes['arrowAlignment'] ?? '';
433 + $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
434 +
435 + if ( $arrowAlignment === 'top' ) {
436 + $css['align-self'] = 'flex-start';
437 + } elseif ( $arrowAlignment === 'bottom' ) {
438 + $css['align-self'] = 'flex-end';
439 + } else {
440 + $css['align-self'] = 'center';
441 + }
442 +
443 + if ( $arrowAlignment === 'top' ) {
444 + $css['margin-top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 4 ) . 'px' : '0';
445 + } elseif ( $arrowAlignment === 'bottom' ) {
446 + $css['margin-bottom'] = $iconBackgroundSize ? ( $iconBackgroundSize / 4 ) . 'px' : '0';
447 + }
448 +
449 + return $css;
450 + }
451 +
452 + public function get_content_timeline_date_css( $attributes, $device = '' ) {
453 + $typographyValueGlobal = $attributes['dateTypographyGlobal'] ? $attributes['dateTypographyGlobal'] : [];
454 + return array_merge(
455 + [ 'color' => Color::get_css( isset( $attributes['dateColor'] ) ? $attributes['dateColor'] : '' ) ],
456 + Typography::get_css( $attributes['dateTypography'] ?? [], '', $device, $typographyValueGlobal )
457 + );
458 + }
459 + public function get_content_timeline_date_mobile_css( $attributes, $device = '' ) {
460 + $css = [];
461 + if ( ! empty( $attributes['dateAlign'] ) ) {
462 + $css['text-align'] = $attributes['dateAlign'];
463 + }
464 + return array_merge(
465 + [ 'background' => Color::get_css( isset( $attributes['dateBackground'] ) ? $attributes['dateBackground'] : '' ) ],
466 + $css,
467 + Dimensions::get_css( $attributes['datePadding'] ?? [], 'padding', $device ),
468 + Border::get_css( $attributes['dateBorder'] ?? [], '', $device )
469 + );
470 + }
471 + public function get_content_timeline_date_hover_mobile_css( $attributes, $device = '' ) {
472 + return array_merge(
473 + Border::get_hover_css( $attributes['dateBorder'] ?? [], '', $device )
474 + );
475 + }
476 +}