widget->get_render_attribute_string( 'ctas' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
$cta ) {
$formatted_link = $this->get_formatted_link_based_on_type_for_cta( $cta );
$cta_image = $cta['cta_link_image'] ?? [];
$cta_has_image = ! empty( $cta_image ) &&
( ! empty( $cta_image['url'] || ! empty( $cta_image['id'] ) ) ) &&
'button' === $ctas_props_type;
// Manage Link class variations
$ctas_classnames = 'e-link-in-bio__cta is-type-' . $ctas_props_type;
if ( 'button' === $ctas_props_type && $ctas_props_show_border ) {
$ctas_classnames .= ' has-border';
}
if ( $cta_has_image ) {
$ctas_classnames .= ' has-image';
}
if ( 'button' === $ctas_props_type ) {
$ctas_classnames .= ' has-corners-' . $ctas_props_corners;
}
// Manage Link attributes
$url_attrs = [
'class' => $ctas_classnames,
'href' => esc_url( $formatted_link ),
];
if (
Social_Network_Provider::FILE_DOWNLOAD === $cta['cta_link_type'] ||
Social_Network_Provider::VCF === $cta['cta_link_type']
) {
$url_attrs['download'] = 'download';
}
$cta_url = $cta['cta_link_url'];
if ( Social_Network_Provider::WAZE == $cta['cta_link_type'] ) {
$cta_url = $cta['cta_link_location'];
}
$url_combined_attrs = $this->get_link_attributes(
$cta_url,
$url_attrs
);
foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
$this->widget->add_render_attribute( 'cta-' . $key, [
$attr_key => $attr_value,
] );
}
?>
widget->get_render_attribute_string( 'cta-' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
'e-link-in-bio__cta-image-element',
] );
} else {
$this->widget->add_render_attribute( 'cta-link-image' . $key, [
'alt' => '',
'class' => 'e-link-in-bio__cta-image-element',
'src' => esc_url( $cta_image['url'] ),
] );
?>
widget->get_render_attribute_string( 'cta-link-image' . $key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
settings['icons_border_show_border'] ?? false;
$icons_props_size = $this->settings['icons_size'] ?? 'small';
$icons_value = $this->settings['icon'] ?? [];
$has_icons = ! empty( $icons_value );
if ( ! $has_icons ) {
return;
}
$this->widget->add_render_attribute( 'icons', [
'class' => 'e-link-in-bio__icons has-size-' . $icons_props_size,
] );
?>
widget->get_render_attribute_string( 'icons' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
$icon ) {
$formatted_link = $this->get_formatted_link_for_icon( $icon );
$icon_class_names = 'e-link-in-bio__icon is-size-' . $icons_props_size;
if ( $icons_props_show_border ) {
$icon_class_names .= ' has-border';
}
$this->widget->add_render_attribute( 'icon-' . $key, [
'class' => $icon_class_names,
] );
// Manage Link attributes
$url_attrs = [
'aria-label' => esc_attr( $icon['icon_platform'] ),
'class' => 'e-link-in-bio__icon-link',
'href' => esc_url( $formatted_link ),
];
$icon_url = $icon['icon_url'];
if ( Social_Network_Provider::WAZE == $icon['icon_platform'] ) {
$icon_url = $icon['icon_location'];
}
$url_combined_attrs = $this->get_link_attributes(
$icon_url,
$url_attrs
);
foreach ( $url_combined_attrs as $attr_key => $attr_value ) {
$this->widget->add_render_attribute( 'icon-link-' . $key, [
$attr_key => $attr_value,
] );
}
?>
settings['bio_heading_tag'] ?? 'h2';
$bio_heading_value = $this->settings['bio_heading'] ?? '';
$bio_title_props_tag = $this->settings['bio_title_tag'] ?? 'h2';
$bio_title_value = $this->settings['bio_title'] ?? '';
if ( 'top' === $this->widget->get_description_position() ) {
$bio_about_heading_props_tag = $this->settings['bio_about_tag'] ?? 'h3';
$bio_about_heading_value = $this->settings['bio_about'] ?? '';
$bio_description_value = $this->settings['bio_description'] ?? '';
}
$has_bio_about_heading = ! empty( $bio_about_heading_value );
$has_bio_description = ! empty( $bio_description_value );
$has_bio_heading = ! empty( $bio_heading_value );
$has_bio_title = ! empty( $bio_title_value );
if ( $has_bio_heading || $has_bio_title || $has_bio_about_heading || $has_bio_description ) {
?>
widget->add_render_attribute( 'heading', 'class', 'e-link-in-bio__heading' );
$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 ) );
// Escaped above
Utils::print_unescaped_internal_string( $bio_heading_output );
} ?>
widget->add_render_attribute( 'title', 'class', 'e-link-in-bio__title' );
$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 ) );
// Escaped above
Utils::print_unescaped_internal_string( $bio_title_output );
} ?>
widget->add_render_attribute( 'about-heading', 'class', 'e-link-in-bio__about-heading' );
$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 ) );
// Escaped above
Utils::print_unescaped_internal_string( $bio_about_heading_output );
} ?>
widget->add_render_attribute( 'description', 'class', 'e-link-in-bio__description' );
$bio_description_output = sprintf( '
%2$s
', $this->widget->get_render_attribute_string( 'description' ), esc_html( $bio_description_value ) );
// Escaped above
Utils::print_unescaped_internal_string( $bio_description_output );
} ?>
widget->get_description_position() ) {
return;
}
$bio_about_heading_props_tag = $this->settings['bio_about_tag'] ?? 'h3';
$bio_about_heading_value = $this->settings['bio_about'] ?? '';
$bio_description_value = $this->settings['bio_description'] ?? '';
$has_bio_description = ! empty( $bio_description_value );
$has_bio_about_heading = ! empty( $bio_about_heading_value );
if ( $has_bio_about_heading || $has_bio_description ) {
?>
[
'props' => [],
'should_render' => false,
'value' => $this->settings['identity_image_cover'] ?? [],
],
'primary_image' => [
'props' => [],
'should_render' => false,
'value' => $this->settings['identity_image'] ?? [],
],
];
$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'] ) ) );
$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'] ) ) );
if ( ! $output_images['primary_image']['should_render'] && ! $output_images['secondary_image']['should_render'] ) {
return;
}
$output_images = $this->set_primary_image_properties( $output_images );
$output_images = $this->set_secondary_image_properties( $output_images );
?>
$image ) :
if ( $image['should_render'] ) :
$this->widget->add_render_attribute( 'identity_image_' . $image_key, [
'class' => $this->get_image_classnames( $image ),
] );
?>
widget->get_render_attribute_string( 'identity_image_' . $image_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
'e-link-in-bio__identity-image-element',
] );
} else {
$this->widget->add_render_attribute( 'identity_image_src' . $image_key, [
'alt' => '',
'class' => 'e-link-in-bio__identity-image-element',
'src' => esc_url( $image['value']['url'] ),
] );
?>
widget->get_render_attribute_string( 'identity_image_src' . $image_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> />
print_shape_divider();
}
?>
settings['advanced_layout_full_screen_height'] ?? '';
$layout_props_full_height_controls = $this->settings['advanced_layout_full_screen_height_controls'] ?? '';
$layout_props_full_width = $this->settings['advanced_layout_full_width_custom'] ?? '';
$layout_props_show_border = $this->settings['background_show_border'] ?? '';
$custom_classes = $this->settings['advanced_custom_css_classes'] ?? '';
$layout_classnames = 'e-link-in-bio e-' . $this->widget->get_name();
if ( 'yes' === $layout_props_show_border ) {
$layout_classnames .= ' has-border';
}
if ( 'yes' === $layout_props_full_width ) {
$layout_classnames .= ' is-full-width';
}
if ( 'yes' === $layout_props_full_height ) {
$layout_classnames .= ' is-full-height';
}
if ( ! empty( $layout_props_full_height_controls ) ) {
foreach ( $layout_props_full_height_controls as $breakpoint ) {
$layout_classnames .= ' is-full-height-' . $breakpoint;
}
}
if ( $custom_classes ) {
$layout_classnames .= ' ' . $custom_classes;
}
$attrs = [
'class' => $layout_classnames,
];
if ( ! empty( $this->settings['advanced_custom_css_id'] ) ) {
$attrs['id'] = $this->settings['advanced_custom_css_id'];
}
$this->widget->add_render_attribute( 'layout', $attrs );
}
private function set_primary_image_properties( array $output_images ): array {
if ( $output_images['primary_image']['should_render'] ) {
$output_images['primary_image']['props']['shape'] = $this->settings['identity_image_shape'] ?? 'circle';
$output_images['primary_image']['props']['style'] = $this->settings['identity_image_style'] ?? 'profile';
$output_images['primary_image']['props']['show_border'] = $this->settings['identity_image_show_border'] ?? false;
$output_images['primary_image']['props']['show_bottom_border'] = $this->settings['identity_image_bottom_show_border'] ?? false;
}
return $output_images;
}
private function set_secondary_image_properties( array $output_images ): array {
if ( $output_images['secondary_image']['should_render'] ) {
$output_images['secondary_image']['props']['style'] = 'cover';
$output_images['secondary_image']['props']['show_bottom_border'] = $this->settings['identity_image_bottom_show_border'] ?? false;
if ( ! empty( $this->settings['identity_section_style_cover_divider_bottom'] ) ) {
$output_images['secondary_image']['props']['has_shape_divider'] = true;
// Remove border if a shaped divider is applied
$output_images['secondary_image']['props']['show_bottom_border'] = false;
}
$output_images['primary_image']['props']['style'] = 'profile';
}
return $output_images;
}
}