I've created a custom fieldtype for "links" which have three input fields (URL, label and target). It works very well and I've now added the only required method to the class in Matrix which is display_cell() (according to the documentation).
My field displays fine, but when I save the entry and edit it again, no data is present in my field.
If I add save_cell() to my class and return some debug data, it is saved to the entry and displayed, but if I just return the data that it is supposed to receive in the method params, I get nothing.
I can, however, force the data to save by fetching it from the post array, as shown here:
function save_cell($data)
{
return json_encode(ee()->input->post($this->settings['field_name']));
}
Obviously, I don't want to do this but $data
is always empty! Any ideas why?
Thanks, Mat
UPDATE: I've answered this below