Dot notation for MB Geolocation "type"

Support MB Builder Dot notation for MB Geolocation "type"Resolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15993
    pzapza
    Participant

    I may be missing something obvious, but I've tested and searched on here to no avail.

    Here's what I'm trying to do:
    - Using MB Builder + MB Geolocation, set the "Types" option to return 2 types. Like in the example on the MB Geolocation docs, I would like to set it to "(cities)" and ""establishment"

    'geo' => array(
        'api_key' => 'YOUR API KEY',
        'types' => array( '(cities)', 'establishment' )
    ),

    How can I do that in the Settings tab of MB Builder?

    I tried adding a custom attribute of geo.types => [{"establishment","(cities)"}]

    But on the front end I get the following error:

    InvalidValueError: setTypes: not an Array
    _.Wc @ js?libraries=places&key=AIzaSyDgNeQLcJwxuVJC8yC_F1HYfXONXoTVaxc&ver=5.2.2:60

    Can this be done with MB Builder + Geolocation?

    Thanks for your help.

    #16001
    Anh TranAnh Tran
    Keymaster

    Hi pza,

    Please set as follows:

    • geo.types.0 = (cities)
    • geo.types.1 = establishment
    #16010
    pzapza
    Participant

    I tried this also but no results show in autocomplete. Perhaps it's just not valid to pass two arguments here? For my purposes address will work for now. Thanks Anh.

    #16424
    brandonjpbrandonjp
    Participant

    @pza I use JSON syntax and it seems to work fine.

    On your custom attribute (in your original post) you're creating an object inside an array:

    I tried adding a custom attribute of geo.types => [{"establishment","(cities)"}]

    But it just needs to be an array with two values: ['establishment','(cities)'] (no inner curly brackets)

    #16566
    pzapza
    Participant

    Ohh, I feel silly now. Thank you!

    #22462
    brandonjpbrandonjp
    Participant

    Just an update that my solution to set a square bracket array... I thought it was working, but realized it's not now and maybe never was!

    So best to stick with Anh Tran's answer #16001 (he's always the best person to trust anyhow 🙂)

    geo.types.0 = (cities)
    geo.types.1 = establishment

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