-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On resave, field data is cleared #13
Comments
Fixed working version can be downloaded from here: https://github.com/bitterendio/acf-field-type-mapmore/releases/tag/0.3.1 |
So removing the json_encode from the hidden input in acf-mapmore-v5.php seems to have fixed the issue. Not sure if this would have a knockon effect on anything else but thought I'd mention! |
@olivianicholls thank you very much for your input, i will hopefully get to test your solution and fix it on this repo as well |
Hy, i try to remove json_encode from hidden input, but i have same issue, and in frontend no loading any polygon :( who know how to fixit ? ~ Fixed with last version |
For frontend i do in thie mode:
|
@ezramod Based on that and your code, it could work something like this: <?php
// Get current map key
$key = '';
$keys = acf_get_setting('mapmore_google_api_key');
if (isset($keys[0])) {
$key = $keys[0];
}
if (!empty($perimetru_cvatral)) { ?>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?v=weekly&key=<?php echo $key; ?>&libraries=places,drawing"></script>
<div id="map" style="height: 400px"></div>
<script type="text/javascript">
var map = new google.maps.Map(document.getElementById('map'));
</script>
<div class="mb-4 overflow-hidden card">
<div class="m-0 acf-map perimetru_cvatral">
<?php switch ($perimetru_cvatral['type']) { case 'rectangle': ?>
<script>
new google.maps.Rectangle({
bounds: <?php echo json_encode($perimetru_cvatral['bounds']); ?>,
map: map
});
</script>
<?php break;case 'polyline': ?>
<script>
new google.maps.Polyline({
path: <?php echo json_encode($perimetru_cvatral['path']); ?>],
map: map,
});
</script>
<?php break;case 'polygon': ?>
<script>
new google.maps.Polygon({
path: <?php echo json_encode($perimetru_cvatral['path']); ?>,
map: map
});
</script>
<?php break;case 'circle': ?>
<script>
new google.maps.Circle({
center: {lat: <?php echo $perimetru_cvatral['lat']; ?>], lng: <?php echo $perimetru_cvatral['lng']; ?>},
radius: <?php echo $perimetru_cvatral['radius']; ?>,
map: map
});
</script>
<?php break;case 'marker': ?>
<script>
new google.maps.Marker({
position: {lat: <?php echo $perimetru_cvatral['lat']; ?>], lng: <?php echo $perimetru_cvatral['lng']; ?>},
map: map,
animation: google.maps.Animation.DROP
});
</script>
<?php break;} ?>
</div>
</div>
<?php } |
@ezramod Sorry for inconvenience. The new update relied on composer autoloads. Please update the plugin once more, the issue is fixed now. |
fix bug, with plugin but map not show on front end i try to understnad where is bug and i do this:
and value for center_lat and center_lng not work on frontend user. can u help me? i try to create polygon |
Fot a good work i do in this mode:
but maps selection is delete if update post without click on maps, if you do change on map and update post, settings is not deleted. |
I have a custom post type that uses an ACF MapMore field that I'm experiencing issues with. When a post has an ACF MapMore field with a value already set, this value is cleared/removed upon resave. After saving I have to go back and reinput the location, which can be quite time consuming if it's using a polygon.
The text was updated successfully, but these errors were encountered: