| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
|
| 8 |
add_shortcode( 'avada_property_map', function( $atts ) { |
| 9 |
$atts = shortcode_atts( array( |
| 10 |
'height' => '', |
| 11 |
'zoom' => '', |
| 12 |
'scrollwheel' => '', |
| 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 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Shared frontend property global used by the Avada shortcode contract; changing $property would break the existing property context passed to these widgets. |
| 27 |
$property = new PH_Property(get_the_ID()); |
| 28 |
} |
| 29 |
|
| 30 |
ob_start(); |
| 31 |
|
| 32 |
$attributes = array(); |
| 33 |
if ( isset($atts['height']) && $atts['height'] != '' ) |
| 34 |
{ |
| 35 |
$attributes['height'] = $atts['height']; |
| 36 |
} |
| 37 |
if ( isset($atts['zoom']) && isset($atts['zoom']['size']) && $atts['zoom']['size'] != '' ) |
| 38 |
{ |
| 39 |
$attributes['zoom'] = $atts['zoom']['size']; |
| 40 |
} |
| 41 |
if ( isset($atts['scrollwheel']) && $atts['scrollwheel'] != '' ) |
| 42 |
{ |
| 43 |
$attributes['scrollwheel'] = $atts['scrollwheel']; |
| 44 |
} |
| 45 |
|
| 46 |
$attributes = apply_filters( 'propertyhive_avada_property_map_attributes', $attributes ); |
| 47 |
|
| 48 |
get_property_map($attributes); |
| 49 |
|
| 50 |
$html = ob_get_clean(); |
| 51 |
|
| 52 |
fusion_element_rendering_elements( false ); |
| 53 |
|
| 54 |
return $html; |
| 55 |
}); |