Using a Open Street Map with an address text field inside a group

Support MB Geolocation Using a Open Street Map with an address text field inside a groupResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38998
    Dan SmithDan Smith
    Participant

    I’m able to display multiple Open Street Maps on a page using an individual Open Street Map custom field and address fields for each map. I put the code for each one in a code element and using grid they display nicely.

    If, instead, I use a group custom field cloneable with sub custom fields of Open Street Map and an address text field I have problems.

    Group ID: location_group
    sub MetaBox custom fields
     Open Streets Map with ID: my_map
     Text field with address ID: my_map_location

    Keeping it simple without a marker using a code element in Bricks Builder, (code copied from https://docs.metabox.io/fields/osm/)
    <?php
    $args = [
    'width' => '640px',
    'height' => '480px',
    ];
    $group_values = rwmb_meta( 'location_group' );
    // If group is cloneable
    foreach ( $group_values as $group_value ) {
    echo RWMB_Map_Field::render_map( $group_value['my_map'], $args );
    }
    ?>

    The maps display briefly and then they bring up a google error

    "Oops! Something went wrong.
    This page didn't load Google Maps correctly. See the JavaScript console for technical details."

    Google shouldn’t have any concern with this, that’s why I was using your Open Street Map custom field.

    Again, I'm using an Open Street Map custom field and not a Google Map.

    Any help with this would be greatly appreciated!

    #39011
    PeterPeter
    Moderator

    Hello Dan,

    Please change the class RWMB_Map_Field to this one RWMB_OSM_Field, it is a typo issue on the documentation and it will be fixed as soon as possible. The code should be

    echo RWMB_OSM_Field::render_map( $group_value['osm'], $args );

    #39021
    Dan SmithDan Smith
    Participant

    Thanks for the reply, once I changed my code to what you suggested everything worked as expected.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.