Thanks for putting this field type out there. It’s very useful. I did, however, run into one problem with it.
At the moment, Google Latlng Lookup doesn’t work with the EE Channel Entries API. The reason for this is that the API calls the field’s save($data) method providing $data as a parameter. Since the save() method as written now overwrites the $data variable with data in the $_POST, the API will write the field into the database as a string with two pipes in it.
In order to make this field_type compatible with the Channel Entries API, you could modify the save() method as follows:
function save($data) { if ( $this->EE->input->post($this->prefix.'address') && $this->EE->input->post($this->prefix.'latitude') && $this->EE->input->post($this->prefix.'longitude') ) { $data = $this->EE->input->post($this->prefix.'address', TRUE) . '|' . $this->EE->input->post($this->prefix.'latitude', TRUE) . '|' . $this->EE->input->post($this->prefix.'longitude', TRUE); } return $data; }
I have not had a chance to test this a whole lot, but wanted to know if you think this will break anything. If not, you may consider adding the conditional above if you want the Channel Entries API to play nicely with your field type.
Thank you.
|