PluginProbe
Elementor Website Builder – more than just a page builder / 3.23.0-dev2
Elementor Website Builder – more than just a page builder v3.23.0-dev2
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / link-in-bio / classes / render / render-base.php

render-base.php in Elementor Website Builder – more than just a page builder 3.23.0-dev2, at modules/link-in-bio/classes/render/render-base.php

597 lines 21.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\LinkInBio\Classes\Render;
4
5 use Elementor\Core\Base\Providers\Social_Network_Provider;
6 use Elementor\Core\Base\Traits\Shared_Widget_Controls_Trait;
7 use Elementor\Icons_Manager;
8 use Elementor\Modules\LinkInBio\Base\Widget_Link_In_Bio_Base;
9 use Elementor\Utils;
10
11 /**
12 * Class Render_Base.
13 *
14 * This is the base class that will hold shared functionality that will be needed by all the various widget versions.
15 *
16 * @since 3.23.0
17 */
18 abstract class Render_Base {
19
20 use Shared_Widget_Controls_Trait;
21
22 protected Widget_Link_In_Bio_Base $widget;
23
24 protected array $settings;
25
26 abstract public function render(): void;
27
28 public function __construct( Widget_Link_In_Bio_Base $widget ) {
29 $this->widget = $widget;
30 $this->settings = $widget->get_settings_for_display();
31 }
32
33 protected function render_image_links(): void {
34 $image_links_value_initial = $this->settings['image_links'] ?? [];
35 $image_links_columns_value = $this->settings['image_links_per_row'] ?? 2;
36
37 /**
38 * if empty returns a sub-array with all empty values
39 * Check for this here to avoid rendering container when empty
40 */
41 $image_links_value = $this->clean_array( $image_links_value_initial );
42 $has_image_links = ! empty( $image_links_value );
43
44 if ( ! $has_image_links ) {
45 return;
46 }
47
48 $image_links_classnames = 'e-link-in-bio__image-links';
49
50 if ( ! empty( $image_links_columns_value ) ) {
51 $image_links_classnames .= ' has-' . $image_links_columns_value . '-columns';
52 }
53
54 $this->widget->add_render_attribute( 'image-links', [
55 'class' => $image_links_classnames,
56 ] );
57 ?>
58
59 <div <?php echo $this->widget->get_render_attribute_string( 'image-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
60 <?php
61 foreach ( $image_links_value as $key => $image_link ) {
62 $formatted_link = $image_link['image_links_url']['url'] ?? '';
63 $image_link_image = $image_link['image_links_image'] ?? [];
64
65 // Manage Link class variations
66
67 $image_link_classnames = 'e-link-in-bio__image-links-link';
68
69 // Manage Link attributes
70
71 $url_attrs = [
72 'class' => $image_link_classnames,
73 'href' => esc_url( $formatted_link ),
74 ];
75
76 $url_combined_attrs = $this->get_link_attributes(
77 $image_link['image_links_url'],
78 $url_attrs
79 );
80
81 foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
82 $this->widget->add_render_attribute( 'image-links-link' . $key, [
83 $attr_key => $attr_value,
84 ] );
85 }
86 ?>
87 <a <?php echo $this->widget->get_render_attribute_string( 'image-links-link' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
88 <?php if ( ! empty( $image_link_image['id'] ) ) {
89 echo wp_get_attachment_image( $image_link_image['id'], 'thumbnail', false, [
90 'class' => 'e-link-in-bio__image-links-img',
91 ] );
92 } else {
93 $this->widget->add_render_attribute( 'image-links-img-' . $key, [
94 'alt' => '',
95 'class' => 'e-link-in-bio__image-links-img',
96 'src' => esc_url( $image_link_image['url'] ),
97 ] );
98 ?>
99 <img <?php echo $this->widget->get_render_attribute_string( 'image-links-img-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
100 <?php }; ?>
101 </a>
102 <?php } ?>
103 </div>
104 <?php
105 }
106
107 protected function render_ctas(): void {
108 $ctas_props_corners = $this->settings['cta_links_corners'] ?? 'rounded';
109 $ctas_props_show_border = $this->settings['cta_links_show_border'] ?? false;
110 $ctas_props_type = $this->settings['cta_links_type'] ?? 'button';
111 $ctas_value_initial = $this->settings['cta_link'] ?? [];
112
113 /**
114 * $this->settings['cta_link'] if empty returns a sub-array with all empty values
115 * Check for this here to avoid rendering container when empty
116 */
117 $ctas_value = $this->clean_array( $ctas_value_initial );
118 $has_ctas = ! empty( $ctas_value );
119
120 if ( ! $has_ctas ) {
121 return;
122 }
123
124 $this->widget->add_render_attribute( 'ctas', [
125 'class' => 'e-link-in-bio__ctas has-type-' . $ctas_props_type,
126 ] );
127 ?>
128
129 <div <?php echo $this->widget->get_render_attribute_string( 'ctas' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
130 <?php
131 foreach ( $ctas_value as $key => $cta ) {
132 $formatted_link = $this->get_formatted_link_based_on_type_for_cta( $cta );
133 $cta_image = $cta['cta_link_image'] ?? [];
134 $cta_has_image = ! empty( $cta_image ) &&
135 ( ! empty( $cta_image['url'] || ! empty( $cta_image['id'] ) ) ) &&
136 'button' === $ctas_props_type;
137
138 // Manage Link class variations
139
140 $ctas_classnames = 'e-link-in-bio__cta is-type-' . $ctas_props_type;
141
142 if ( 'button' === $ctas_props_type && $ctas_props_show_border ) {
143 $ctas_classnames .= ' has-border';
144 }
145
146 if ( $cta_has_image ) {
147 $ctas_classnames .= ' has-image';
148 }
149
150 if ( 'button' === $ctas_props_type ) {
151 $ctas_classnames .= ' has-corners-' . $ctas_props_corners;
152 }
153
154 // Manage Link attributes
155
156 $url_attrs = [
157 'class' => $ctas_classnames,
158 'href' => esc_url( $formatted_link ),
159 ];
160
161 if (
162 Social_Network_Provider::FILE_DOWNLOAD === $cta['cta_link_type'] ||
163 Social_Network_Provider::VCF === $cta['cta_link_type']
164 ) {
165 $url_attrs['download'] = 'download';
166 }
167
168 if ( $cta['cta_link_url'] ) {
169 $url_combined_attrs = $this->get_link_attributes(
170 $cta['cta_link_url'],
171 $url_attrs
172 );
173
174 foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
175 $this->widget->add_render_attribute( 'cta-' . $key, [
176 $attr_key => $attr_value,
177 ] );
178 }
179 }
180
181 if ( $cta['cta_link_location'] ) {
182 $waze_combined_attrs = $this->get_link_attributes(
183 $cta['cta_link_location'],
184 $url_attrs
185 );
186
187 foreach ( $waze_combined_attrs as $attr_key => $attr_value ) {
188 $this->widget->add_render_attribute( 'cta-' . $key, [
189 $attr_key => $attr_value,
190 ] );
191 }
192 }
193 ?>
194 <a <?php echo $this->widget->get_render_attribute_string( 'cta-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
195 <?php if ( $cta_has_image ) : ?>
196 <span class="e-link-in-bio__cta-image">
197 <?php if ( ! empty( $cta_image['id'] ) ) {
198 echo wp_get_attachment_image( $cta_image['id'], 'thumbnail', false, [
199 'class' => 'e-link-in-bio__cta-image-element',
200 ] );
201 } else {
202 $this->widget->add_render_attribute( 'cta-link-image' . $key, [
203 'alt' => '',
204 'class' => 'e-link-in-bio__cta-image-element',
205 'src' => esc_url( $cta_image['url'] ),
206 ] );
207 ?>
208 <img <?php echo $this->widget->get_render_attribute_string( 'cta-link-image' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
209 <?php }; ?>
210 </span>
211 <?php endif; ?>
212 <span class="e-link-in-bio__cta-text">
213 <?php echo esc_html( $cta['cta_link_text'] ); ?>
214 </span>
215 </a>
216 <?php } ?>
217 </div>
218 <?php
219 }
220
221 protected function render_icons(): void {
222 $icons_props_show_border = $this->settings['icons_border_show_border'] ?? false;
223 $icons_props_size = $this->settings['icons_size'] ?? 'small';
224 $icons_value = $this->settings['icon'] ?? [];
225
226 $has_icons = ! empty( $icons_value );
227 if ( ! $has_icons ) {
228 return;
229 }
230
231 $this->widget->add_render_attribute( 'icons', [
232 'class' => 'e-link-in-bio__icons has-size-' . $icons_props_size,
233 ] );
234 ?>
235 <div <?php echo $this->widget->get_render_attribute_string( 'icons' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
236 <?php
237 foreach ( $icons_value as $key => $icon ) {
238
239 $formatted_link = $this->get_formatted_link_for_icon( $icon );
240
241 $icon_class_names = 'e-link-in-bio__icon is-size-' . $icons_props_size;
242
243 if ( $icons_props_show_border ) {
244 $icon_class_names .= ' has-border';
245 }
246
247 $this->widget->add_render_attribute( 'icon-' . $key, [
248 'class' => $icon_class_names,
249 ] );
250
251 // Manage Link attributes
252
253 $url_attrs = [
254 'aria-label' => esc_attr( $icon['icon_platform'] ),
255 'class' => 'e-link-in-bio__icon-link',
256 'href' => esc_url( $formatted_link ),
257 ];
258
259 $url_combined_attrs = $this->get_link_attributes(
260 $icon['icon_url'],
261 $url_attrs
262 );
263
264 foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
265 $this->widget->add_render_attribute( 'icon-link-' . $key, [
266 $attr_key => $attr_value,
267 ] );
268 }
269 ?>
270 <div <?php echo $this->widget->get_render_attribute_string( 'icon-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
271 <a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
272 <span class="e-link-in-bio__icon-svg">
273 <?php
274 $mapping = Social_Network_Provider::get_icon_mapping( $icon['icon_platform'] );
275 $icon_lib = explode( ' ', $mapping )[0];
276 $library = 'fab' === $icon_lib ? 'fa-brands' : 'fa-solid';
277 Icons_Manager::render_icon(
278 [
279 'library' => $library,
280 'value' => $mapping,
281 ],
282 [ 'aria-hidden' => 'true' ]
283 );
284 ?>
285 </span>
286 <?php if ( ! empty( $icon['icon_text'] ) ) : ?>
287 <span class="e-link-in-bio__icon-label">
288 <?php echo esc_html( $icon['icon_text'] ); ?>
289 </span>
290 <?php endif; ?>
291 </a>
292 </div>
293 <?php } ?>
294 </div>
295 <?php
296 }
297
298 protected function render_bio(): void {
299 $bio_heading_props_tag = $this->settings['bio_heading_tag'] ?? 'h2';
300 $bio_heading_value = $this->settings['bio_heading'] ?? '';
301
302 $bio_title_props_tag = $this->settings['bio_title_tag'] ?? 'h2';
303 $bio_title_value = $this->settings['bio_title'] ?? '';
304
305 if ( 'top' === $this->widget->get_description_position() ) {
306 $bio_about_heading_props_tag = $this->settings['bio_about_tag'] ?? 'h3';
307 $bio_about_heading_value = $this->settings['bio_about'] ?? '';
308
309 $bio_description_value = $this->settings['bio_description'] ?? '';
310 }
311
312 $has_bio_about_heading = ! empty( $bio_about_heading_value );
313 $has_bio_description = ! empty( $bio_description_value );
314 $has_bio_heading = ! empty( $bio_heading_value );
315 $has_bio_title = ! empty( $bio_title_value );
316
317 if ( $has_bio_heading || $has_bio_title || $has_bio_about_heading || $has_bio_description ) {
318 ?>
319 <div class="e-link-in-bio__bio">
320 <?php if ( $has_bio_heading ) {
321 $this->widget->add_render_attribute( 'heading', 'class', 'e-link-in-bio__heading' );
322 $bio_heading_output = sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $bio_heading_props_tag ), $this->widget->get_render_attribute_string( 'heading' ), esc_html( $bio_heading_value ) );
323 // Escaped above
324 Utils::print_unescaped_internal_string( $bio_heading_output );
325 } ?>
326 <?php if ( $has_bio_title ) {
327 $this->widget->add_render_attribute( 'title', 'class', 'e-link-in-bio__title' );
328 $bio_title_output = sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $bio_title_props_tag ), $this->widget->get_render_attribute_string( 'title' ), esc_html( $bio_title_value ) );
329 // Escaped above
330 Utils::print_unescaped_internal_string( $bio_title_output );
331 } ?>
332 <?php if ( $has_bio_about_heading ) {
333 $this->widget->add_render_attribute( 'about-heading', 'class', 'e-link-in-bio__about-heading' );
334 $bio_about_heading_output = sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $bio_about_heading_props_tag ), $this->widget->get_render_attribute_string( 'about-heading' ), esc_html( $bio_about_heading_value ) );
335 // Escaped above
336 Utils::print_unescaped_internal_string( $bio_about_heading_output );
337 } ?>
338 <?php if ( $has_bio_description ) {
339 $this->widget->add_render_attribute( 'description', 'class', 'e-link-in-bio__description' );
340 $bio_description_output = sprintf( '<p %1$s>%2$s</p>', $this->widget->get_render_attribute_string( 'description' ), esc_html( $bio_description_value ) );
341 // Escaped above
342 Utils::print_unescaped_internal_string( $bio_description_output );
343 } ?>
344 </div>
345 <?php
346 }
347 }
348
349 protected function render_footer_bio(): void {
350 if ( 'bottom' !== $this->widget->get_description_position() ) {
351 return;
352 }
353
354 $bio_about_heading_props_tag = $this->settings['bio_about_tag'] ?? 'h3';
355 $bio_about_heading_value = $this->settings['bio_about'] ?? '';
356
357 $bio_description_value = $this->settings['bio_description'] ?? '';
358
359 $has_bio_description = ! empty( $bio_description_value );
360 $has_bio_about_heading = ! empty( $bio_about_heading_value );
361
362 if ( $has_bio_about_heading || $has_bio_description ) {
363 ?>
364 <div class="e-link-in-bio__bio e-link-in-bio__bio--footer">
365 <?php if ( $has_bio_about_heading ) {
366 $this->widget->add_render_attribute( 'about-heading', 'class', 'e-link-in-bio__about-heading' );
367 $bio_about_heading_output = sprintf( '<%1$s %2$s>%3$s</%1$s>', Utils::validate_html_tag( $bio_about_heading_props_tag ), $this->widget->get_render_attribute_string( 'about-heading' ), esc_html( $bio_about_heading_value ) );
368 // Escaped above
369 Utils::print_unescaped_internal_string( $bio_about_heading_output );
370 } ?>
371 <?php if ( $has_bio_description ) {
372 $this->widget->add_render_attribute( 'description', 'class', 'e-link-in-bio__description' );
373 $bio_description_output = sprintf( '<p %1$s>%2$s</p>', $this->widget->get_render_attribute_string( 'description' ), esc_html( $bio_description_value ) );
374 // Escaped above
375 Utils::print_unescaped_internal_string( $bio_description_output );
376 } ?>
377 </div>
378 <?php
379 }
380 }
381
382 protected function render_identity_image(): void {
383 /**
384 * Get base data for potential images
385 * Note order is important - secondary must render before primary
386 */
387 $output_images = [
388 'secondary_image' => [
389 'props' => [],
390 'should_render' => false,
391 'value' => $this->settings['identity_image_cover'] ?? [],
392 ],
393 'primary_image' => [
394 'props' => [],
395 'should_render' => false,
396 'value' => $this->settings['identity_image'] ?? [],
397 ],
398 ];
399
400 $output_images['primary_image']['should_render'] = ! empty( $output_images['primary_image']['value'] ) && ( ! empty( $output_images['primary_image']['value']['url'] || ! empty( $output_images['primary_image']['value']['id'] ) ) );
401 $output_images['secondary_image']['should_render'] = ! empty( $output_images['secondary_image']['value'] ) && ( ! empty( $output_images['secondary_image']['value']['url'] || ! empty( $output_images['secondary_image']['value']['id'] ) ) );
402
403 if ( ! $output_images['primary_image']['should_render'] && ! $output_images['secondary_image']['should_render'] ) {
404 return;
405 }
406
407 $output_images = $this->set_primary_image_properties( $output_images );
408
409 $output_images = $this->set_secondary_image_properties( $output_images );
410 ?>
411 <div class="e-link-in-bio__identity">
412 <?php
413 foreach ( $output_images as $image_key => $image ) :
414 if ( $image['should_render'] ) :
415 $this->widget->add_render_attribute( 'identity_image_' . $image_key, [
416 'class' => $this->get_image_classnames( $image ),
417 ] );
418 ?>
419 <div <?php echo $this->widget->get_render_attribute_string( 'identity_image_' . $image_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
420 <?php if ( ! empty( $image['value']['id'] ) ) {
421 echo wp_get_attachment_image( $image['value']['id'], 'medium', false, [
422 'class' => 'e-link-in-bio__identity-image-element',
423 ] );
424 } else {
425 $this->widget->add_render_attribute( 'identity_image_src' . $image_key, [
426 'alt' => '',
427 'class' => 'e-link-in-bio__identity-image-element',
428 'src' => esc_url( $image['value']['url'] ),
429 ] );
430 ?>
431 <img <?php echo $this->widget->get_render_attribute_string( 'identity_image_src' . $image_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
432
433 <?php }; ?>
434 <?php
435 if ( ! empty( $image['props']['has_shape_divider'] ) ) {
436 $this->print_shape_divider();
437 }
438 ?>
439 </div>
440 <?php
441 endif;
442 endforeach;
443 ?>
444 </div>
445 <?php
446 }
447
448 protected function get_image_classnames( array $image ): string {
449 $image_classnames = 'e-link-in-bio__identity-image e-link-in-bio__identity-image-' . $image['props']['style'];
450 if ( ! empty( $image['props']['show_border'] ) || ! empty( $image['props']['show_bottom_border'] ) ) {
451 $image_classnames .= ' has-border';
452 }
453 if ( ! empty( $image['props']['shape'] ) && 'profile' === $image['props']['style'] ) {
454 $image_classnames .= ' has-style-' . $image['props']['shape'];
455 }
456 if ( ! empty( $image['props']['has_shape_divider'] ) ) {
457 $image_classnames .= ' has-shape-divider';
458 }
459 return $image_classnames;
460 }
461
462 protected function get_formatted_link_based_on_type_for_cta( array $cta ): string {
463 $formatted_link = $cta['cta_link_url']['url'] ?? '';
464
465 // Ensure we clear the default link value if the matching type value is empty
466 switch ( $cta['cta_link_type'] ) {
467 case Social_Network_Provider::EMAIL:
468 $formatted_link = Social_Network_Provider::build_email_link( $cta, 'cta_link' );
469 break;
470 case Social_Network_Provider::TELEPHONE:
471 $formatted_link = ! empty( $cta['cta_link_number'] ) ? 'tel:' . $cta['cta_link_number'] : '';
472 break;
473 case Social_Network_Provider::MESSENGER:
474 $formatted_link = ! empty( $icon['cta_link_username'] ) ?
475 'https://www.facebook.com/messages/t/' . $icon['icon_username'] :
476 '';
477 break;
478 case Social_Network_Provider::WAZE:
479 $formatted_link = ! empty( $cta['cta_link_location']['url'] ) ? $cta['cta_link_location']['url'] : '';
480 break;
481 case Social_Network_Provider::WHATSAPP:
482 $formatted_link = ! empty( $cta['cta_link_number'] ) ? 'https://wa.me/' . $cta['cta_link_number'] : '';
483 break;
484 case Social_Network_Provider::FILE_DOWNLOAD:
485 $formatted_link = ! empty( $cta['cta_link_file']['url'] ) ? $cta['cta_link_file']['url'] : '';
486 break;
487 case Social_Network_Provider::VCF:
488 $formatted_link = ! empty( $cta['cta_link_file']['url'] ) ? $cta['cta_link_file']['url'] : '';
489 break;
490 default:
491 break;
492 }
493
494 return $formatted_link;
495 }
496
497 protected function get_formatted_link_for_icon( array $icon ): string {
498 $formatted_link = $icon['icon_url']['url'] ?? '';
499
500 // Ensure we clear the default link value if the matching type value is empty
501 switch ( $icon['icon_platform'] ) {
502 case Social_Network_Provider::EMAIL:
503 $formatted_link = Social_Network_Provider::build_email_link( $icon, 'icon' );
504 break;
505 case Social_Network_Provider::TELEPHONE:
506 $formatted_link = ! empty( $icon['icon_number'] ) ? 'tel:' . $icon['icon_number'] : '';
507 break;
508 case Social_Network_Provider::MESSENGER:
509 $formatted_link = ! empty( $icon['icon_username'] ) ?
510 'https://www.facebook.com/messages/t/' . $icon['icon_username'] :
511 '';
512 break;
513 case Social_Network_Provider::WAZE:
514 $formatted_link = ! empty( $icon['icon_location']['url'] ) ? $icon['icon_location']['url'] : '';
515 break;
516 case Social_Network_Provider::WHATSAPP:
517 $formatted_link = ! empty( $icon['icon_number'] ) ? 'https://wa.me/' . $icon['icon_number'] : '';
518 break;
519 default:
520 break;
521 }
522
523 return $formatted_link;
524 }
525
526 protected function build_layout_render_attribute(): void {
527 $layout_props_full_height = $this->settings['advanced_layout_full_screen_height'] ?? '';
528 $layout_props_full_height_controls = $this->settings['advanced_layout_full_screen_height_controls'] ?? '';
529 $layout_props_full_width = $this->settings['advanced_layout_full_width_custom'] ?? '';
530 $layout_props_show_border = $this->settings['background_show_border'] ?? '';
531 $custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
532
533 $layout_classnames = 'e-link-in-bio e-' . $this->widget->get_name();
534
535 if ( 'yes' === $layout_props_show_border ) {
536 $layout_classnames .= ' has-border';
537 }
538
539 if ( 'yes' === $layout_props_full_width ) {
540 $layout_classnames .= ' is-full-width';
541 }
542
543 if ( 'yes' === $layout_props_full_height ) {
544 $layout_classnames .= ' is-full-height';
545 }
546
547 if ( ! empty( $layout_props_full_height_controls ) ) {
548 foreach ( $layout_props_full_height_controls as $breakpoint ) {
549 $layout_classnames .= ' is-full-height-' . $breakpoint;
550 }
551 }
552
553 if ( $custom_classes ) {
554 $layout_classnames .= ' ' . $custom_classes;
555 }
556
557 $attrs = [
558 'class' => $layout_classnames,
559 ];
560
561 if ( ! empty( $this->settings['advanced_custom_css_id'] ) ) {
562 $attrs['id'] = $this->settings['advanced_custom_css_id'];
563 }
564
565 $this->widget->add_render_attribute( 'layout', $attrs );
566 }
567
568 private function set_primary_image_properties( array $output_images ): array {
569 if ( $output_images['primary_image']['should_render'] ) {
570 $output_images['primary_image']['props']['shape'] = $this->settings['identity_image_shape'] ?? 'circle';
571 $output_images['primary_image']['props']['style'] = $this->settings['identity_image_style'] ?? 'profile';
572 $output_images['primary_image']['props']['show_border'] = $this->settings['identity_image_show_border'] ?? false;
573 $output_images['primary_image']['props']['show_bottom_border'] = $this->settings['identity_image_bottom_show_border'] ?? false;
574 }
575
576 return $output_images;
577 }
578
579 private function set_secondary_image_properties( array $output_images ): array {
580 if ( $output_images['secondary_image']['should_render'] ) {
581 $output_images['secondary_image']['props']['style'] = 'cover';
582 $output_images['secondary_image']['props']['show_bottom_border'] = $this->settings['identity_image_bottom_show_border'] ?? false;
583
584 if ( ! empty( $this->settings['identity_section_style_cover_divider_bottom'] ) ) {
585 $output_images['secondary_image']['props']['has_shape_divider'] = true;
586
587 // Remove border if a shaped divider is applied
588 $output_images['secondary_image']['props']['show_bottom_border'] = false;
589 }
590
591 $output_images['primary_image']['props']['style'] = 'profile';
592 }
593
594 return $output_images;
595 }
596 }
597