Current File : /home/n742ef5/royalanteam.com/wp-content/themes/myhome/templates/widgets/model/listing_map.php
<?php
/* @var Tangibledesign\MyHome\Widgets\Listing\ListingMapWidget $mhCurrentWidget */
global $mhCurrentWidget;
if (empty(tdf_settings()->getGoogleMapsApiKey())) {
    return;
}

$mhLocationField = $mhCurrentWidget->getLocationField();
if (!$mhLocationField) {
    return;
}

$mhLocation = $mhCurrentWidget->getLocation();
if (!$mhLocation) {
    return;
}
?>

<div class="myhome-listing-map-anchor"></div>

<div class="myhome-listing-section myhome-app">
    <?php if ($mhCurrentWidget->hasLabel()) : ?>
        <h3 class="myhome-listing-section__label">
            <?php echo esc_html($mhCurrentWidget->getLabel()); ?>
        </h3>
    <?php endif; ?>

    <div class="myhome-listing-section__content">
        <?php if (tdf_settings()->getMapProvider() === \Tangibledesign\Framework\Core\Settings\SettingKey::MAP_PROVIDER_GOOGLE_MAPS) : ?>
            <mh-simple-google-map
                    map-id="myhome-listing-map-<?php echo esc_attr($mhCurrentWidget->get_id()); ?>"
                    map-type="<?php echo esc_attr($mhLocationField->getMapType()); ?>"
                    :zoom="<?php echo esc_attr(tdf_settings()->getMapZoomLevel()); ?>"
                    :position="<?php echo htmlspecialchars(json_encode($mhLocation)); ?>"
            >
                <div
                        slot-scope="props"
                        id="myhome-listing-map-<?php echo esc_attr($mhCurrentWidget->get_id()); ?>"
                        class="myhome-listing-map"
                ></div>
            </mh-simple-google-map>
        <?php elseif (tdf_settings()->getMapProvider() === \Tangibledesign\Framework\Core\Settings\SettingKey::MAP_PROVIDER_OPEN_STREET_MAP) : ?>
            <mh-simple-open-street-map
                    map-id="myhome-listing-map-<?php echo esc_attr($mhCurrentWidget->get_id()); ?>"
                    :zoom="<?php echo esc_attr(tdf_settings()->getMapZoomLevel()); ?>"
                    :position="<?php echo htmlspecialchars(json_encode($mhLocation)); ?>"
            >
                <div
                        slot-scope="props"
                        id="myhome-listing-map-<?php echo esc_attr($mhCurrentWidget->get_id()); ?>"
                        class="myhome-listing-map"
                ></div>
            </mh-simple-open-street-map>
        <?php endif; ?>
    </div>
</div>