I’m developing a custom fieldtype. It is an array of input data, so in my save method I serialize the data.
function save($data)
{
return ($data) ? base64_encode(serialize($data)) : '';
}That works great from within the CP. But if I try using a SAEF, I get a MySQL error:
INSERT INTO exp_channel_data (`entry_id`, `channel_id`, `site_id`, `field_id_3`, `field_id_4`, `field_id_5`, `field_id_6`, `field_id_13`, `field_id_1`, `field_ft_6`) VALUES (27, '1', '1', '', '', '', 0, 0, Array, 'none')It looks like my POSTed array is never getting serialized. I traced through the code, and found that when $this->EE->api_channel_entries->submit_new_entry() is called from within channel_standalone->insert_new_entry(), that after the api_channel_fields class is instantiated, it’s settings array is empty: $this->EE->api_channel_fields->settings (around line 1563 in Api_channel_entries), and so the save method of the fieldtype never gets called.
Any work arounds? Am I being dumb in some way? I’m using v2.0.2pb01. Thanks.
as far as I’ve been able to tell, EE2’s SAEF code pretty much completely ignores the existence of custom fieldtypes.
I’m not sure whether this’ll get addressed by EL devs as a bug or not, you might want to post about it on the EE2 SAEF feature request thread here.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.