Custom Fields
Re-Envisioned
Support Meta Box Geolocation Only auto populate neighborhood field if not empty Reply To: Only auto populate neighborhood field if not empty

#13277

pluginoven
Participant

Two weeks and crickets… The following changes would need to be made to include the
'bind_if_empty' => false, //default true
idea described above.

File: js/mp-geo.js
Line: 85

var $this = $( this ),
    dataBinding = $this.data( 'binding' ),
    dataBindEmpty = $this.data( 'bind_if_empty' ),
    addressField = $this.data( 'address_field' ),
    fieldValue = that.getFieldData( dataBinding, place );

File: inc/class-meta-box-geolocation.php
Line: 97

$binding = isset( $field['binding'] ) ? $field['binding'] : $this->guessBindingField( $field['id'] );
$bind_if_empty = isset( $field['bind_if_empty'] ) ? $field['bind_if_empty'] : 1;
$address_field = isset( $field['address_field'] ) ? $field['address_field'] : '';

if ( $binding ) {
            $begin .= '<script type="html/template" class="rwmb-geo-binding" data-binding="' . esc_attr( $binding )
            . '" data-bind_if_empty="' . esc_attr( $bind_if_empty )
            . '" data-address_field="' . esc_attr( $address_field )
...

Would be fantastically 2019 if there was a magical way to submit a pull request.