We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Fieldtype save() method not being called in SAEF

Development and Programming

Rob Sanchez's avatar
Rob Sanchez
335 posts
15 years ago
Rob Sanchez's avatar Rob Sanchez

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.

       
ender's avatar
ender
1,644 posts
15 years ago
ender's avatar ender

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.

       
Rob Sanchez's avatar
Rob Sanchez
335 posts
15 years ago
Rob Sanchez's avatar Rob Sanchez

Thanks for the heads up, ender.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.