If your posts have a custom field created with ACF plugin, and you want that field to be used for setting region statuses, add the code below to MapSVG > Menu > JS > afterLoad (replacing the existing code).
Example considers that there's an ACF field with the name statusFieldName
that
needs to be connected to MapSVG status
field. Change statusFieldName
to your own field name and change the values
of acfToMapsvgStatuses
object to match with your data.
function (){
var mapsvg = this;
var acfToMapsvgStatuses = {
// first number is the ACF field value, second number is MapSVG status
"1": 1,
"2": 2,
"3": 3
};
mapsvg.regionsRepository.events.on("loaded", function() {
mapsvg.regionsRepository.getLoaded().forEach( function(region){
if(region.post && region.post.acf){
var status = acfToMapsvgStatuses[region.post.acf.statusFieldName];
if(typeof status !== "undefined"){
mapsvg.getRegion(region.id).setStatus(status)
}
}
});
});
}