PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.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
← All changes | includes/blocks/content-timeline/block.php +182 -77 2.8.0 → 2.14.0 View file →
@@ -27,75 +27,82 @@
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 );
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 + );
63 90 // Conditional CSS generation based on arrowAlignment
64 - $arrowAlignment = $attributes['arrowAlignment'] ?? 'top';
65 91
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',
92 + $css_generator->add_class_styles(
93 + '{{WRAPPER}} .ablocks-block-content-timeline-child--line-center .ablocks-block-content-timeline-child__arrow',
69 94 $this->get_content_timeline_arrow_css( $attributes ),
70 95 $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
71 - $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
96 + $this->get_content_timeline_arrow_css( $attributes, 'Mobile' ),
97 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_arrow_css( $attributes, $device ); } )
72 98 );
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 99 $css_generator->add_class_styles(
94 100 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
95 101 $this->get_content_timeline_date_css( $attributes ),
96 102 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
97 - $this->get_content_timeline_date_css( $attributes, 'Mobile' )
103 + $this->get_content_timeline_date_css( $attributes, 'Mobile' ),
104 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_css( $attributes, $device ); } )
98 105 );
99 106 $css_generator->add_class_styles(
100 107 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
101 108 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
@@ -107,27 +114,31 @@
107 114 $css_generator->add_class_styles(
108 115 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
109 116 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
110 117 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
111 - $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' )
118 + $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' ),
119 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_center_css( $attributes, $device ); } )
112 120 );
113 121 $css_generator->add_class_styles(
114 122 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
115 123 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
116 124 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
117 - $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' )
125 + $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' ),
126 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_left_right_css( $attributes, $device ); } )
118 127 );
119 128 $css_generator->add_class_styles(
120 129 '{{WRAPPER}} .ablocks-block-content-timeline--left .ablocks-block-content-timeline__line,.ablocks-block-content-timeline--right .ablocks-block-content-timeline__line',
121 130 $this->get_content_timeline_show_date_left_right_line_css( $attributes, '' ),
122 131 $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' )
132 + $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Mobile' ),
133 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_left_right_line_css( $attributes, $device ); } )
124 134 );
125 135 $css_generator->add_class_styles(
126 136 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
127 137 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
128 138 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
129 - $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' )
139 + $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' ),
140 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_mobile_css( $attributes, $device ); } )
130 141 );
131 142
132 143 return $css_generator->generate_css();
133 144 }
@@ -138,75 +149,82 @@
138 149 $css_generator->add_class_styles(
139 150 '{{WRAPPER}} .ablocks-icon-maker svg',
140 151 $this->get_content_timeline_icon_css( $attributes ),
141 152 $this->get_content_timeline_icon_css( $attributes, 'Tablet' ),
142 - $this->get_content_timeline_icon_css( $attributes, 'Mobile' )
153 + $this->get_content_timeline_icon_css( $attributes, 'Mobile' ),
154 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_css( $attributes, $device ); } )
143 155 );
144 156 $css_generator->add_class_styles(
145 157 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
146 158 $this->get_content_timeline_icon_background_css( $attributes ),
147 159 $this->get_content_timeline_icon_background_css( $attributes, 'Tablet' ),
148 - $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' )
160 + $this->get_content_timeline_icon_background_css( $attributes, 'Mobile' ),
161 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_icon_background_css( $attributes, $device ); } )
149 162 );
150 163 $css_generator->add_class_styles(
151 164 '{{WRAPPER}} .ablocks-block-content-timeline .ablocks-block-content-timeline__line',
152 165 $this->get_content_timeline_connector_css( $attributes ),
153 166 $this->get_content_timeline_connector_css( $attributes, 'Tablet' ),
154 - $this->get_content_timeline_connector_css( $attributes, 'Mobile' )
167 + $this->get_content_timeline_connector_css( $attributes, 'Mobile' ),
168 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_connector_css( $attributes, $device ); } )
155 169 );
156 170 $css_generator->add_class_styles(
157 171 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field',
158 172 $this->get_content_timeline_item_gap_css( $attributes ),
159 173 $this->get_content_timeline_item_gap_css( $attributes, 'Tablet' ),
160 - $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' )
174 + $this->get_content_timeline_item_gap_css( $attributes, 'Mobile' ),
175 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_item_gap_css( $attributes, $device ); } )
161 176 );
162 177 $css_generator->add_class_styles(
178 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap',
179 + $this->get_content_timeline_horizontal_gap_css( $attributes ),
180 + $this->get_content_timeline_horizontal_gap_css( $attributes, 'Tablet' ),
181 + $this->get_content_timeline_horizontal_gap_css( $attributes, 'Mobile' ),
182 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_horizontal_gap_css( $attributes, $device ); } )
183 + );
184 + $css_generator->add_class_styles(
163 185 '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks-block-content-timeline-child--field .ablocks-block-content-timeline-child__content-part',
164 186 $this->get_content_timeline_content_css( $attributes ),
165 187 $this->get_content_timeline_content_css( $attributes, 'Tablet' ),
166 - $this->get_content_timeline_content_css( $attributes, 'Mobile' )
188 + $this->get_content_timeline_content_css( $attributes, 'Mobile' ),
189 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_content_css( $attributes, $device ); } )
167 190 );
168 191 $css_generator->add_class_styles(
169 192 '{{WRAPPER}} .ablocks-block-content-timeline-child__content-part .ablocks-block-content-timeline-child__arrow::after',
170 193 $this->get_content_timeline_content_background_css( $attributes ),
171 194 $this->get_content_timeline_content_background_css( $attributes, 'Tablet' ),
172 - $this->get_content_timeline_content_background_css( $attributes, 'Mobile' )
195 + $this->get_content_timeline_content_background_css( $attributes, 'Mobile' ),
196 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_content_background_css( $attributes, $device ); } )
173 197 );
198 + $css_generator->add_class_styles(
199 + '{{WRAPPER}} .ablocks-block-content-timeline--outer-wrap .ablocks__in-view-icon',
200 + $this->get_content_timeline_connector_alignment_css( $attributes ),
201 + $this->get_content_timeline_connector_alignment_css( $attributes, 'Tablet' ),
202 + $this->get_content_timeline_connector_alignment_css( $attributes, 'Mobile' ),
203 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_connector_alignment_css( $attributes, $device ); } )
204 + );
205 + $css_generator->add_class_styles(
206 + '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
207 + $this->get_content_timeline_date_alignment_css( $attributes ),
208 + $this->get_content_timeline_date_alignment_css( $attributes, 'Tablet' ),
209 + $this->get_content_timeline_date_alignment_css( $attributes, 'Mobile' ),
210 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_alignment_css( $attributes, $device ); } )
211 + );
174 212 // Conditional CSS generation based on arrowAlignment
175 - $arrowAlignment = $attributes['arrowAlignment'] ?? 'top';
176 213
177 - if ( $arrowAlignment === 'top' ) {
178 214 $css_generator->add_class_styles(
179 - '{{WRAPPER}} .ablocks-block-content-timeline-child--line-top .ablocks-block-content-timeline-child__arrow',
215 + '{{WRAPPER}} .ablocks-block-content-timeline-child--line-center .ablocks-block-content-timeline-child__arrow',
180 216 $this->get_content_timeline_arrow_css( $attributes ),
181 217 $this->get_content_timeline_arrow_css( $attributes, 'Tablet' ),
182 - $this->get_content_timeline_arrow_css( $attributes, 'Mobile' )
218 + $this->get_content_timeline_arrow_css( $attributes, 'Mobile' ),
219 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_arrow_css( $attributes, $device ); } )
183 220 );
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 221 $css_generator->add_class_styles(
205 222 '{{WRAPPER}} .ablocks-block-content-timeline-child__date,.ablocks-block-content-timeline-child__inner-content-date',
206 223 $this->get_content_timeline_date_css( $attributes ),
207 224 $this->get_content_timeline_date_css( $attributes, 'Tablet' ),
208 - $this->get_content_timeline_date_css( $attributes, 'Mobile' )
225 + $this->get_content_timeline_date_css( $attributes, 'Mobile' ),
226 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_date_css( $attributes, $device ); } )
209 227 );
210 228 $css_generator->add_class_styles(
211 229 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
212 230 $this->get_content_timeline_date_mobile_css( $attributes, 'Mobile' )
@@ -218,27 +236,31 @@
218 236 $css_generator->add_class_styles(
219 237 '{{WRAPPER}} .ablocks-block-content-timeline-child__date-inner',
220 238 $this->get_content_timeline_show_date_center_css( $attributes, '' ),
221 239 $this->get_content_timeline_show_date_center_css( $attributes, 'Tablet' ),
222 - $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' )
240 + $this->get_content_timeline_show_date_center_css( $attributes, 'Mobile' ),
241 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_center_css( $attributes, $device ); } )
223 242 );
224 243 $css_generator->add_class_styles(
225 244 '{{WRAPPER}} .ablocks-block-content-timeline-child__date',
226 245 $this->get_content_timeline_show_date_left_right_css( $attributes, '' ),
227 246 $this->get_content_timeline_show_date_left_right_css( $attributes, 'Tablet' ),
228 - $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' )
247 + $this->get_content_timeline_show_date_left_right_css( $attributes, 'Mobile' ),
248 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_left_right_css( $attributes, $device ); } )
229 249 );
230 250 $css_generator->add_class_styles(
231 251 '{{WRAPPER}} .ablocks-block-content-timeline--left .ablocks-block-content-timeline__line,.ablocks-block-content-timeline--right .ablocks-block-content-timeline__line',
232 252 $this->get_content_timeline_show_date_left_right_line_css( $attributes, '' ),
233 253 $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' )
254 + $this->get_content_timeline_show_date_left_right_line_css( $attributes, 'Mobile' ),
255 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_left_right_line_css( $attributes, $device ); } )
235 256 );
236 257 $css_generator->add_class_styles(
237 258 '{{WRAPPER}} .ablocks-block-content-timeline-child__inner-content-date',
238 259 $this->get_content_timeline_show_date_mobile_css( $attributes, '' ),
239 260 $this->get_content_timeline_show_date_mobile_css( $attributes, 'Tablet' ),
240 - $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' )
261 + $this->get_content_timeline_show_date_mobile_css( $attributes, 'Mobile' ),
262 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_content_timeline_show_date_mobile_css( $attributes, $device ); } )
241 263 );
242 264
243 265 return $css_generator->generate_css();
244 266 }
@@ -247,8 +269,29 @@
247 269 return $this->build_css_v2( $attributes );
248 270 }
249 271 return $this->build_css_v1( $attributes );
250 272 }
273 + // Top / Bottom content positions lay the timeline out horizontally.
274 + public function is_horizontal_timeline( $attributes ) {
275 + return in_array( $attributes['contentPosition'] ?? '', [ 'top', 'bottom' ], true );
276 + }
277 +
278 + public function get_content_timeline_horizontal_gap_css( $attributes, $device = '' ) {
279 + if ( ! $this->is_horizontal_timeline( $attributes ) ) {
280 + return [];
281 + }
282 + return Range::get_css([
283 + 'attributeValue' => $attributes['itemGap'],
284 + 'attribute_object_key' => 'value',
285 + 'defaultValue' => 10,
286 + 'isResponsive' => true,
287 + 'hasUnit' => true,
288 + 'unitDefaultValue' => 'px',
289 + 'property' => 'gap',
290 + 'device' => $device,
291 + ]);
292 + }
293 +
251 294 public function get_content_timeline_show_date_mobile_css( $attributes, $device = '' ) {
252 295 $css = [];
253 296 if ( $device === '' || $device === 'Tablet' ) {
254 297 $css['display'] = 'none';
@@ -279,9 +322,9 @@
279 322 public function get_content_timeline_show_date_left_right_css( $attribute, $device ) {
280 323 $css = [];
281 324 $showDateKey = $device ? "showDate{$device}" : 'showDate';
282 325 $showDate = $attribute[ $showDateKey ] ?? null;
283 - $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right' ], true );
326 + $isLeftOrRight = in_array( $attribute['contentPosition'], [ 'left', 'right', 'top', 'bottom' ], true );
284 327
285 328 if ( $isLeftOrRight ) {
286 329 if ( $device !== 'Mobile' ) {
287 330 $css['display'] = $showDate ? 'block !important' : 'none !important';
@@ -405,8 +448,11 @@
405 448 );
406 449 }
407 450
408 451 public function get_content_timeline_item_gap_css( $attributes, $device = '' ) {
452 + if ( $this->is_horizontal_timeline( $attributes ) ) {
453 + return [ '--ablocks-content-timeline-icon-size' => ( ! empty( $attributes['iconBackgroundSize'] ) ? $attributes['iconBackgroundSize'] : 48 ) . 'px' ];
454 + }
409 455 $css = [];
410 456 return array_merge(
411 457 Range::get_css([
412 458 'attributeValue' => $attributes['itemGap'],
@@ -441,19 +487,64 @@
441 487 isset( $attributes['contentBackgroundColor'] ) ? $attributes['contentBackgroundColor'] : '');
442 488 }
443 489 return $css;
444 490 }
491 + // public function get_content_timeline_arrow_css( $attributes, $device = '' ) {
492 + // $css = [];
493 + // $arrowAlignment = $attributes['arrowAlignment'] ?? '';
494 + // $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
495 +
496 + // if ( $arrowAlignment === 'top' ) {
497 + // $css['height'] = '0px';
498 + // $css['top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
499 + // } elseif ( $arrowAlignment === 'bottom' ) {
500 + // $css['height'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
501 + // $css['bottom'] = '0';
502 + // }
503 +
504 + // return $css;
505 + // }
506 +
445 507 public function get_content_timeline_arrow_css( $attributes, $device = '' ) {
508 + $css = [];
509 + if ( $this->is_horizontal_timeline( $attributes ) ) {
510 + return $css;
511 + }
512 + $arrowAlignment = $attributes['arrowAlignment'] ?? '';
513 + $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
514 +
515 + // Existing logic + updated styles
516 + if ( $arrowAlignment === 'top' ) {
517 + $css['height'] = '35px';
518 + $css['top'] = '10%';
519 + $css['transform'] = 'translateY(-50%)';
520 + $css['-webkit-transform'] = 'translateY(-50%)';
521 +
522 + } elseif ( $arrowAlignment === 'bottom' ) {
523 + $css['height'] = '35px';
524 + $css['top'] = '90%';
525 + $css['transform'] = 'translateY(-50%)';
526 + $css['-webkit-transform'] = 'translateY(-50%)';
527 +
528 + } elseif ( $arrowAlignment === 'centre' ) {
529 + $css['height'] = '35px';
530 + $css['top'] = '50%';
531 + $css['transform'] = 'translateY(-50%)';
532 + $css['-webkit-transform'] = 'translateY(-50%)';
533 + }
534 +
535 + return $css;
536 + }
537 + public function get_content_timeline_connector_alignment_css( $attributes, $device = '' ) {
446 538 $css = [];
447 539 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
448 - $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
449 540
450 541 if ( $arrowAlignment === 'top' ) {
451 - $css['height'] = '0px';
452 - $css['top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
542 + $css['align-self'] = 'flex-start';
453 543 } elseif ( $arrowAlignment === 'bottom' ) {
454 - $css['height'] = $iconBackgroundSize ? ( $iconBackgroundSize / 2 ) . 'px' : '0';
455 - $css['bottom'] = '0';
544 + $css['align-self'] = 'flex-end';
545 + } else {
546 + $css['align-self'] = 'center';
456 547 }
457 548
458 549 return $css;
459 550 }
@@ -458,11 +549,25 @@
458 549 return $css;
459 550 }
460 551 public function get_content_timeline_date_alignment_css( $attributes, $device = '' ) {
461 552 $css = [];
553 + if ( $this->is_horizontal_timeline( $attributes ) ) {
554 + return [
555 + 'align-self' => 'stretch',
556 + 'text-align' => ! empty( $attributes['dateAlign'] ) ? $attributes['dateAlign'] : 'left',
557 + ];
558 + }
462 559
463 560 $arrowAlignment = $attributes['arrowAlignment'] ?? '';
464 561 $iconBackgroundSize = $attributes['iconBackgroundSize'] ?? '';
562 +
563 + if ( $arrowAlignment === 'top' ) {
564 + $css['align-self'] = 'flex-start';
565 + } elseif ( $arrowAlignment === 'bottom' ) {
566 + $css['align-self'] = 'flex-end';
567 + } else {
568 + $css['align-self'] = 'center';
569 + }
465 570
466 571 if ( $arrowAlignment === 'top' ) {
467 572 $css['margin-top'] = $iconBackgroundSize ? ( $iconBackgroundSize / 4 ) . 'px' : '0';
468 573 } elseif ( $arrowAlignment === 'bottom' ) {