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 +128 -151 2.8.1 → 2.16.0 View file →
@@ -27,75 +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 - // 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 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(
94 91 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
95 92 $this->get_content_timeline_date_css( $attributes ),
96 93 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
97 - $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 ); } )
98 96 );
99 97 $css_generator->add_class_styles(
100 98 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
101 99 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
@@ -107,27 +105,24 @@
107 105 $css_generator->add_class_styles(
108 106 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
109 107 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
110 108 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
111 - $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 ); } )
112 111 );
113 112 $css_generator->add_class_styles(
114 113 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
115 114 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
116 115 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
117 - $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 ); } )
118 118 );
119 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 120 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
127 121 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
128 122 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
129 - $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 ); } )
130 125 );
131 126
132 127 return $css_generator->generate_css();
133 128 }
@@ -138,75 +133,73 @@
138 133 $css_generator->add_class_styles(
139 134 '{{WRAPPER}} .ablocks-icon-maker svg',
140 135 $this->get_content_timeline_icon_css( $attributes ),
141 136 $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
142 - $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 ); } )
143 139 );
144 140 $css_generator->add_class_styles(
145 141 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
146 142 $this->get_content_timeline_icon_background_css( $attributes ),
147 143 $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
148 - $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 ); } )
149 146 );
150 147 $css_generator->add_class_styles(
151 148 '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
152 149 $this->get_content_timeline_connector_css( $attributes ),
153 150 $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
154 - $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 ); } )
155 153 );
156 154 $css_generator->add_class_styles(
157 155 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
158 156 $this->get_content_timeline_item_gap_css( $attributes ),
159 157 $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
160 - $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 ); } )
161 160 );
162 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(
163 169 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
164 170 $this->get_content_timeline_content_css( $attributes ),
165 171 $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
166 - $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 ); } )
167 174 );
168 175 $css_generator->add_class_styles(
169 176 '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
170 177 $this->get_content_timeline_content_background_css( $attributes ),
171 178 $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
172 - $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 ); } )
173 181 );
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 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(
205 197 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
206 198 $this->get_content_timeline_date_css( $attributes ),
207 199 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
208 - $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 ); } )
209 202 );
210 203 $css_generator->add_class_styles(
211 204 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
212 205 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
@@ -218,27 +211,24 @@
218 211 $css_generator->add_class_styles(
219 212 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
220 213 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
221 214 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
222 - $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 ); } )
223 217 );
224 218 $css_generator->add_class_styles(
225 219 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
226 220 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
227 221 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
228 - $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 ); } )
229 224 );
230 225 $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 226 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
238 227 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
239 228 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
240 - $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 ); } )
241 231 );
242 232
243 233 return $css_generator->generate_css();
244 234 }
@@ -247,8 +237,29 @@
247 237 return $this->build_css_v2( $attributes );
248 238 }
249 239 return $this->build_css_v1( $attributes );
250 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 +
251 262 public function get_content_timeline_show_date_mobile_css( $attributes, $device = '' ) {
252 263 $css = [];
253 264 if ( $device === '' || $device === 'Tablet' ) {
254 265 $css['display'] = 'none';
@@ -279,9 +290,9 @@
279 290 public function get_content_timeline_show_date_left_right_css( $attribute, $device ) {
280 291 $css = [];
281 292 $showDateKey = $device ? "showDate{$device}" : 'showDate';
282 293 $showDate = $attribute[ $showDateKey ] ?? null;
283 - $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right' ], true );
294 + $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right', 'top', 'bottom' ], true );
284 295
285 296 if ( $isLeftOrRight ) {
286 297 if ( $device !== 'Mobile' ) {
287 298 $css['display'] = $showDate ? 'block !important' : 'none !important';
@@ -295,39 +306,8 @@
295 306 }
296 307
297 308 return $css;
298 309 }
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 310 public function get_content_timeline_icon_css( $attributes, $device = '' ) {
331 311 $css = [];
332 312 return array_merge(
333 313 [ 'fill' => Color::get_css( isset( $attributes['iconColor'] ) ? $attributes['iconColor'] : '' ) ],
@@ -381,33 +361,17 @@
381 361 'attribute_object_key' => 'value',
382 362 'defaultValue' => 3,
383 363 'property' => 'width',
384 364 ]),
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 365 );
406 366 }
407 367
408 368 public function get_content_timeline_item_gap_css( $attributes, $device = '' ) {
409 - $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 : [];
410 374 return array_merge(
411 375 Range::get_css([
412 376 'attributeValue' => $attributes['itemGap'],
413 377 'attribute_object_key' => 'value',
@@ -441,19 +405,18 @@
441 405 isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
442 406 }
443 407 return $css;
444 408 }
445 - public function get_content_timeline_arrow_css( $attributes, $device = '' ) {
409 + public function get_content_timeline_connector_alignment_css( $attributes, $device = '' ) {
446 410 $css = [];
447 411 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
448 - $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
449 412
450 413 if ( $arrowAlignment === 'top' ) {
451 - $css['height'] = '0px';
452 - $css['top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
414 + $css['align-self'] = 'flex-start';
453 415 } elseif ( $arrowAlignment === 'bottom' ) {
454 - $css['height'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
455 - $css['bottom'] = '0';
416 + $css['align-self'] = 'flex-end';
417 + } else {
418 + $css['align-self'] = 'center';
456 419 }
457 420
458 421 return $css;
459 422 }
@@ -458,11 +421,25 @@
458 421 return $css;
459 422 }
460 423 public function get_content_timeline_date_alignment_css( $attributes, $device = '' ) {
461 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 + }
462 431
463 432 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
464 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 + }
465 442
466 443 if ( $arrowAlignment === 'top' ) {
467 444 $css['margin-top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 4 ) . 'px' : '0';
468 445 } elseif ( $arrowAlignment === 'bottom' ) {