How can I pull the address from a field type that is not Address?

The Maps Premium View requires to setup an address field as the source to geocode the map markers. That Address field is by default a standard Gravity Forms address field type. 

You may select which address field you want to use under the View settings metabox > Maps, address field setting:

What happens when you have stored the entry address in a different field type (e.g. Single Line Text) ?

Override the Address Field setting

In order to override the Address Field setting, you may use the filter hook gravityview/maps/markers/address/field_id as in the following example:

/**
 * Custom Maps address field ID
 * @param mixed $field_id Gravity Forms field ID
 * @param GravityView_View object $view Current View object
 */
function my_gv_maps_address_field( $field_id, $view ) {
    if ( 'MY_VIEW_ID' != $view->view_id ) {
        return $field_id;
    }
    return 'MY_NEW_FIELD_ID';
}
add_filter( 'gravityview/maps/markers/address/field_id', 'my_gv_maps_address_field', 10, 2 );

// Note: Replace the MY_VIEW_ID by the View ID where you'll want to apply this code and the MY_NEW_FIELD_ID by the form field ID containing the address string.

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us