Address not saved on post saving
Opened this issue · 3 comments
As per title, the address map is not saved, only latitude and longitude
Hi @widoz. This has been suggested a few times, it's possible to tweak the field to also save the search field.
For me, this goes beyond the initial scope of the field, it was intended to simply save lat/long. The field can be used alongside additional fields to save address information in any format required.
It's knowing at what point to stop. The next feature request will be to save each address component separately. These are all great features but move the field away from being a lightweight, simple map field implementation.
I think saving the address in the search field is worthwhile. I'm undecided whether this should be an additional option or on by default?
Hi @mustardBees
Thank you for your response. Right now I changed the field input by adding the input search as cmb2 field in this way:
echo $field_type_object->input( array(
'type' => 'text',
'name' => $field->args( '_name' ) . '[address]',
'value' => isset( $field_escaped_value['address'] ) ? $field_escaped_value['address'] : '',
'class' => 'large-text pw-map-search',
'desc' => '',
) );
And works well. At least you can ignore the array item.
I used your code and I think this is useful functionality.