| 1 |
<?php |
| 2 |
|
| 3 |
add_shortcode( 'avada_property_enquiry_form_link', function( $atts ) { |
| 4 |
$atts = shortcode_atts( array( |
| 5 |
'content_align' => 'left', |
| 6 |
'fusion_font_family_enquiry_form_link_font' => '', |
| 7 |
'fusion_font_variant_enquiry_form_link_font' => '', |
| 8 |
'font_size' => '', |
| 9 |
'letter_spacing' => '', |
| 10 |
'text_transform' => '', |
| 11 |
'line_height' => '', |
| 12 |
'text_color' => '', |
| 13 |
), $atts ); |
| 14 |
|
| 15 |
if ( get_post_type( get_the_ID() ) != 'property' ) |
| 16 |
{ |
| 17 |
return ''; |
| 18 |
} |
| 19 |
|
| 20 |
fusion_element_rendering_elements( true ); |
| 21 |
|
| 22 |
global $property; |
| 23 |
|
| 24 |
if ( empty($property) ) |
| 25 |
{ |
| 26 |
$property = new PH_Property(get_the_ID()); |
| 27 |
} |
| 28 |
|
| 29 |
$style = Fusion_Builder_Element_Helper::get_font_styling( $atts, 'enquiry_form_link_font' ); |
| 30 |
|
| 31 |
if ( $atts['font_size'] ) { |
| 32 |
$style .= 'font-size:' . fusion_library()->sanitize->get_value_with_unit( $atts['font_size'] ) . ';'; |
| 33 |
} |
| 34 |
|
| 35 |
if ( $atts['letter_spacing'] ) { |
| 36 |
$style .= 'letter-spacing:' . fusion_library()->sanitize->get_value_with_unit( $atts['letter_spacing'] ) . ';'; |
| 37 |
} |
| 38 |
|
| 39 |
if ( ! empty( $atts['text_transform'] ) ) { |
| 40 |
$style .= 'text-transform:' . $atts['text_transform'] . ';'; |
| 41 |
} |
| 42 |
|
| 43 |
if ( ! empty( $atts['content_align'] ) ) { |
| 44 |
$style .= 'text-align:' . $atts['content_align'] . ';'; |
| 45 |
} |
| 46 |
|
| 47 |
ob_start(); |
| 48 |
?> |
| 49 |
|
| 50 |
<a data-fancybox data-src="#makeEnquiry<?php echo $property->id; ?>" href="javascript:;" style="<?php echo $style; ?>"><?php echo esc_html(__( 'Make Enquiry', 'propertyhive' )); ?></a> |
| 51 |
|
| 52 |
<!-- LIGHTBOX FORM --> |
| 53 |
<div id="makeEnquiry<?php echo (int)$property->id; ?>" style="display:none;"> |
| 54 |
|
| 55 |
<h2><?php echo esc_html(__( 'Make Enquiry', 'propertyhive' )); ?></h2> |
| 56 |
|
| 57 |
<p><?php _e( 'Please complete the form below and a member of staff will be in touch shortly.', 'propertyhive' ); ?></p> |
| 58 |
|
| 59 |
<?php propertyhive_enquiry_form(); ?> |
| 60 |
|
| 61 |
</div> |
| 62 |
<!-- END LIGHTBOX FORM --> |
| 63 |
|
| 64 |
<?php |
| 65 |
|
| 66 |
$html = ob_get_clean(); |
| 67 |
|
| 68 |
fusion_element_rendering_elements( false ); |
| 69 |
|
| 70 |
return $html; |
| 71 |
}); |