PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-dev2
Elementor Website Builder – more than just a page builder v4.0.0-dev2
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 4.0.7 All 451 releases
elementor / modules / link-in-bio / classes / render / render-base.php

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

594 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 $cta_url = $cta['cta_link_url'];
169
170 if ( Social_Network_Provider::WAZE == $cta['cta_link_type'] ) {
171 $cta_url = $cta['cta_link_location'];
172 }
173
174 $url_combined_attrs = $this->get_link_attributes(
175 $cta_url,
176 $url_attrs
177 );
178
179 foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
180 $this->widget->add_render_attribute( 'cta-' . $key, [
181 $attr_key => $attr_value,
182 ] );
183 }
184 ?>
185 <a <?php echo $this->widget->get_render_attribute_string( 'cta-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
186 <?php if ( $cta_has_image ) : ?>
187 <span class="e-link-in-bio__cta-image">
188 <?php if ( ! empty( $cta_image['id'] ) ) {
189 echo wp_get_attachment_image( $cta_image['id'], 'thumbnail', false, [
190 'class' => 'e-link-in-bio__cta-image-element',
191 ] );
192 } else {
193 $this->widget->add_render_attribute( 'cta-link-image' . $key, [
194 'alt' => '',
195 'class' => 'e-link-in-bio__cta-image-element',
196 'src' => esc_url( $cta_image['url'] ),
197 ] );
198 ?>
199 <img <?php echo $this->widget->get_render_attribute_string( 'cta-link-image' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
200 <?php } ?>
201 </span>
202 <?php endif; ?>
203 <span class="e-link-in-bio__cta-text">
204 <?php echo esc_html( $cta['cta_link_text'] ); ?>
205 </span>
206 </a>
207 <?php } ?>
208 </div>
209 <?php
210 }
211
212 protected function render_icons(): void {
213 $icons_props_show_border = $this->settings['icons_border_show_border'] ?? false;
214 $icons_props_size = $this->settings['icons_size'] ?? 'small';
215 $icons_value = $this->settings['icon'] ?? [];
216
217 $has_icons = ! empty( $icons_value );
218 if ( ! $has_icons ) {
219 return;
220 }
221
222 $this->widget->add_render_attribute( 'icons', [
223 'class' => 'e-link-in-bio__icons has-size-' . $icons_props_size,
224 ] );
225 ?>
226 <div <?php echo $this->widget->get_render_attribute_string( 'icons' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
227 <?php
228 foreach ( $icons_value as $key => $icon ) {
229
230 $formatted_link = $this->get_formatted_link_for_icon( $icon );
231
232 $icon_class_names = 'e-link-in-bio__icon is-size-' . $icons_props_size;
233
234 if ( $icons_props_show_border ) {
235 $icon_class_names .= ' has-border';
236 }
237
238 $this->widget->add_render_attribute( 'icon-' . $key, [
239 'class' => $icon_class_names,
240 ] );
241
242 // Manage Link attributes
243
244 $url_attrs = [
245 'aria-label' => esc_attr( $icon['icon_platform'] ),
246 'class' => 'e-link-in-bio__icon-link',
247 'href' => esc_url( $formatted_link ),
248 ];
249
250 $icon_url = $icon['icon_url'];
251
252 if ( Social_Network_Provider::WAZE == $icon['icon_platform'] ) {
253 $icon_url = $icon['icon_location'];
254 }
255
256 $url_combined_attrs = $this->get_link_attributes(
257 $icon_url,
258 $url_attrs
259 );
260
261 foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
262 $this->widget->add_render_attribute( 'icon-link-' . $key, [
263 $attr_key => $attr_value,
264 ] );
265 }
266 ?>
267 <div <?php echo $this->widget->get_render_attribute_string( 'icon-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
268 <a <?php echo $this->widget->get_render_attribute_string( 'icon-link-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
269 <span class="e-link-in-bio__icon-svg">
270 <?php
271 $mapping = Social_Network_Provider::get_icon_mapping( $icon['icon_platform'] );
272 $icon_lib = explode( ' ', $mapping )[0];
273 $library = 'fab' === $icon_lib ? 'fa-brands' : 'fa-solid';
274 Icons_Manager::render_icon(
275 [
276 'library' => $library,
277 'value' => $mapping,
278 ],
279 [ 'aria-hidden' => 'true' ]
280 );
281 ?>
282 </span>
283 <?php if ( ! empty( $icon['icon_text'] ) ) : ?>
284 <span class="e-link-in-bio__icon-label">
285 <?php echo esc_html( $icon['icon_text'] ); ?>
286 </span>
287 <?php endif; ?>
288 </a>
289 </div>
290 <?php } ?>
291 </div>
292 <?php
293 }
294
295 protected function render_bio(): void {
296 $bio_heading_props_tag = $this->settings['bio_heading_tag'] ?? 'h2';
297 $bio_heading_value = $this->settings['bio_heading'] ?? '';
298
299 $bio_title_props_tag = $this->settings['bio_title_tag'] ?? 'h2';
300 $bio_title_value = $this->settings['bio_title'] ?? '';
301
302 if ( 'top' === $this->widget->get_description_position() ) {
303 $bio_about_heading_props_tag = $this->settings['bio_about_tag'] ?? 'h3';
304 $bio_about_heading_value = $this->settings['bio_about'] ?? '';
305
306 $bio_description_value = $this->settings['bio_description'] ?? '';
307 }
308
309 $has_bio_about_heading = ! empty( $bio_about_heading_value );
310 $has_bio_description = ! empty( $bio_description_value );
311 $has_bio_heading = ! empty( $bio_heading_value );
312 $has_bio_title = ! empty( $bio_title_value );
313
314 if ( $has_bio_heading || $has_bio_title || $has_bio_about_heading || $has_bio_description ) {
315 ?>
316 <div class="e-link-in-bio__bio">
317 <?php if ( $has_bio_heading ) {
318 $this->widget->add_render_attribute( 'heading', 'class', 'e-link-in-bio__heading' );
319 $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 ) );
320 // Escaped above
321 Utils::print_unescaped_internal_string( $bio_heading_output );
322 } ?>
323 <?php if ( $has_bio_title ) {
324 $this->widget->add_render_attribute( 'title', 'class', 'e-link-in-bio__title' );
325 $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 ) );
326 // Escaped above
327 Utils::print_unescaped_internal_string( $bio_title_output );
328 } ?>
329 <?php if ( $has_bio_about_heading ) {
330 $this->widget->add_render_attribute( 'about-heading', 'class', 'e-link-in-bio__about-heading' );
331 $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 ) );
332 // Escaped above
333 Utils::print_unescaped_internal_string( $bio_about_heading_output );
334 } ?>
335 <?php if ( $has_bio_description ) {
336 $this->widget->add_render_attribute( 'description', 'class', 'e-link-in-bio__description' );
337 $bio_description_output = sprintf( '<p %1$s>%2$s</p>', $this->widget->get_render_attribute_string( 'description' ), esc_html( $bio_description_value ) );
338 // Escaped above
339 Utils::print_unescaped_internal_string( $bio_description_output );
340 } ?>
341 </div>
342 <?php
343 }
344 }
345
346 protected function render_footer_bio(): void {
347 if ( 'bottom' !== $this->widget->get_description_position() ) {
348 return;
349 }
350
351 $bio_about_heading_props_tag = $this->settings['bio_about_tag'] ?? 'h3';
352 $bio_about_heading_value = $this->settings['bio_about'] ?? '';
353
354 $bio_description_value = $this->settings['bio_description'] ?? '';
355
356 $has_bio_description = ! empty( $bio_description_value );
357 $has_bio_about_heading = ! empty( $bio_about_heading_value );
358
359 if ( $has_bio_about_heading || $has_bio_description ) {
360 ?>
361 <div class="e-link-in-bio__bio e-link-in-bio__bio--footer">
362 <?php if ( $has_bio_about_heading ) {
363 $this->widget->add_render_attribute( 'about-heading', 'class', 'e-link-in-bio__about-heading' );
364 $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 ) );
365 // Escaped above
366 Utils::print_unescaped_internal_string( $bio_about_heading_output );
367 } ?>
368 <?php if ( $has_bio_description ) {
369 $this->widget->add_render_attribute( 'description', 'class', 'e-link-in-bio__description' );
370 $bio_description_output = sprintf( '<p %1$s>%2$s</p>', $this->widget->get_render_attribute_string( 'description' ), esc_html( $bio_description_value ) );
371 // Escaped above
372 Utils::print_unescaped_internal_string( $bio_description_output );
373 } ?>
374 </div>
375 <?php
376 }
377 }
378
379 protected function render_identity_image(): void {
380 /**
381 * Get base data for potential images
382 * Note order is important - secondary must render before primary
383 */
384 $output_images = [
385 'secondary_image' => [
386 'props' => [],
387 'should_render' => false,
388 'value' => $this->settings['identity_image_cover'] ?? [],
389 ],
390 'primary_image' => [
391 'props' => [],
392 'should_render' => false,
393 'value' => $this->settings['identity_image'] ?? [],
394 ],
395 ];
396
397 $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'] ) ) );
398 $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'] ) ) );
399
400 if ( ! $output_images['primary_image']['should_render'] && ! $output_images['secondary_image']['should_render'] ) {
401 return;
402 }
403
404 $output_images = $this->set_primary_image_properties( $output_images );
405
406 $output_images = $this->set_secondary_image_properties( $output_images );
407 ?>
408 <div class="e-link-in-bio__identity">
409 <?php
410 foreach ( $output_images as $image_key => $image ) :
411 if ( $image['should_render'] ) :
412 $this->widget->add_render_attribute( 'identity_image_' . $image_key, [
413 'class' => $this->get_image_classnames( $image ),
414 ] );
415 ?>
416 <div <?php echo $this->widget->get_render_attribute_string( 'identity_image_' . $image_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
417 <?php if ( ! empty( $image['value']['id'] ) ) {
418 echo wp_get_attachment_image( $image['value']['id'], 'medium', false, [
419 'class' => 'e-link-in-bio__identity-image-element',
420 ] );
421 } else {
422 $this->widget->add_render_attribute( 'identity_image_src' . $image_key, [
423 'alt' => '',
424 'class' => 'e-link-in-bio__identity-image-element',
425 'src' => esc_url( $image['value']['url'] ),
426 ] );
427 ?>
428 <img <?php echo $this->widget->get_render_attribute_string( 'identity_image_src' . $image_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
429
430 <?php } ?>
431 <?php
432 if ( ! empty( $image['props']['has_shape_divider'] ) ) {
433 $this->print_shape_divider();
434 }
435 ?>
436 </div>
437 <?php
438 endif;
439 endforeach;
440 ?>
441 </div>
442 <?php
443 }
444
445 protected function get_image_classnames( array $image ): string {
446 $image_classnames = 'e-link-in-bio__identity-image e-link-in-bio__identity-image-' . $image['props']['style'];
447 if ( ! empty( $image['props']['show_border'] ) || ! empty( $image['props']['show_bottom_border'] ) ) {
448 $image_classnames .= ' has-border';
449 }
450 if ( ! empty( $image['props']['shape'] ) && 'profile' === $image['props']['style'] ) {
451 $image_classnames .= ' has-style-' . $image['props']['shape'];
452 }
453 if ( ! empty( $image['props']['has_shape_divider'] ) ) {
454 $image_classnames .= ' has-shape-divider';
455 }
456 return $image_classnames;
457 }
458
459 protected function get_formatted_link_based_on_type_for_cta( array $cta ): string {
460 $formatted_link = $cta['cta_link_url']['url'] ?? '';
461
462 // Ensure we clear the default link value if the matching type value is empty
463 switch ( $cta['cta_link_type'] ) {
464 case Social_Network_Provider::EMAIL:
465 $formatted_link = Social_Network_Provider::build_email_link( $cta, 'cta_link' );
466 break;
467 case Social_Network_Provider::TELEPHONE:
468 $formatted_link = ! empty( $cta['cta_link_number'] ) ? 'tel:' . $cta['cta_link_number'] : '';
469 break;
470 case Social_Network_Provider::MESSENGER:
471 $formatted_link = ! empty( $cta['cta_link_username'] ) ?
472 Social_Network_Provider::build_messenger_link( $cta['cta_link_username'] ) :
473 '';
474 break;
475 case Social_Network_Provider::WAZE:
476 $formatted_link = ! empty( $cta['cta_link_location']['url'] ) ? $cta['cta_link_location']['url'] : '';
477 break;
478 case Social_Network_Provider::WHATSAPP:
479 $formatted_link = ! empty( $cta['cta_link_number'] ) ? 'https://wa.me/' . $cta['cta_link_number'] : '';
480 break;
481 case Social_Network_Provider::FILE_DOWNLOAD:
482 $formatted_link = ! empty( $cta['cta_link_file']['url'] ) ? $cta['cta_link_file']['url'] : '';
483 break;
484 case Social_Network_Provider::VCF:
485 $formatted_link = ! empty( $cta['cta_link_file']['url'] ) ? $cta['cta_link_file']['url'] : '';
486 break;
487 default:
488 break;
489 }
490
491 return $formatted_link;
492 }
493
494 protected function get_formatted_link_for_icon( array $icon ): string {
495 $formatted_link = $icon['icon_url']['url'] ?? '';
496
497 // Ensure we clear the default link value if the matching type value is empty
498 switch ( $icon['icon_platform'] ) {
499 case Social_Network_Provider::EMAIL:
500 $formatted_link = Social_Network_Provider::build_email_link( $icon, 'icon' );
501 break;
502 case Social_Network_Provider::TELEPHONE:
503 $formatted_link = ! empty( $icon['icon_number'] ) ? 'tel:' . $icon['icon_number'] : '';
504 break;
505 case Social_Network_Provider::MESSENGER:
506 $formatted_link = ! empty( $icon['icon_username'] ) ?
507 Social_Network_Provider::build_messenger_link( $icon['icon_username'] ) :
508 '';
509 break;
510 case Social_Network_Provider::WAZE:
511 $formatted_link = ! empty( $icon['icon_location']['url'] ) ? $icon['icon_location']['url'] : '';
512 break;
513 case Social_Network_Provider::WHATSAPP:
514 $formatted_link = ! empty( $icon['icon_number'] ) ? 'https://wa.me/' . $icon['icon_number'] : '';
515 break;
516 default:
517 break;
518 }
519
520 return $formatted_link;
521 }
522
523 protected function build_layout_render_attribute(): void {
524 $layout_props_full_height = $this->settings['advanced_layout_full_screen_height'] ?? '';
525 $layout_props_full_height_controls = $this->settings['advanced_layout_full_screen_height_controls'] ?? '';
526 $layout_props_full_width = $this->settings['advanced_layout_full_width_custom'] ?? '';
527 $layout_props_show_border = $this->settings['background_show_border'] ?? '';
528 $custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
529
530 $layout_classnames = 'e-link-in-bio e-' . $this->widget->get_name();
531
532 if ( 'yes' === $layout_props_show_border ) {
533 $layout_classnames .= ' has-border';
534 }
535
536 if ( 'yes' === $layout_props_full_width ) {
537 $layout_classnames .= ' is-full-width';
538 }
539
540 if ( 'yes' === $layout_props_full_height ) {
541 $layout_classnames .= ' is-full-height';
542 }
543
544 if ( ! empty( $layout_props_full_height_controls ) ) {
545 foreach ( $layout_props_full_height_controls as $breakpoint ) {
546 $layout_classnames .= ' is-full-height-' . $breakpoint;
547 }
548 }
549
550 if ( $custom_classes ) {
551 $layout_classnames .= ' ' . $custom_classes;
552 }
553
554 $attrs = [
555 'class' => $layout_classnames,
556 ];
557
558 if ( ! empty( $this->settings['advanced_custom_css_id'] ) ) {
559 $attrs['id'] = $this->settings['advanced_custom_css_id'];
560 }
561
562 $this->widget->add_render_attribute( 'layout', $attrs );
563 }
564
565 private function set_primary_image_properties( array $output_images ): array {
566 if ( $output_images['primary_image']['should_render'] ) {
567 $output_images['primary_image']['props']['shape'] = $this->settings['identity_image_shape'] ?? 'circle';
568 $output_images['primary_image']['props']['style'] = $this->settings['identity_image_style'] ?? 'profile';
569 $output_images['primary_image']['props']['show_border'] = $this->settings['identity_image_show_border'] ?? false;
570 $output_images['primary_image']['props']['show_bottom_border'] = $this->settings['identity_image_bottom_show_border'] ?? false;
571 }
572
573 return $output_images;
574 }
575
576 private function set_secondary_image_properties( array $output_images ): array {
577 if ( $output_images['secondary_image']['should_render'] ) {
578 $output_images['secondary_image']['props']['style'] = 'cover';
579 $output_images['secondary_image']['props']['show_bottom_border'] = $this->settings['identity_image_bottom_show_border'] ?? false;
580
581 if ( ! empty( $this->settings['identity_section_style_cover_divider_bottom'] ) ) {
582 $output_images['secondary_image']['props']['has_shape_divider'] = true;
583
584 // Remove border if a shaped divider is applied
585 $output_images['secondary_image']['props']['show_bottom_border'] = false;
586 }
587
588 $output_images['primary_image']['props']['style'] = 'profile';
589 }
590
591 return $output_images;
592 }
593 }
594