Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292509

hook_field_presave() not called reliably

$
0
0

During my research on which field-hooks can manipulate the item data I've found that there seems to be no guarantee that hook_field_presave() is ever called. The responsibility to call field_attach_presave() lies with the module that implements the entity type.

Also field_attach_presave() is not executed at all for default values from the instance settings. This practically makes hook_presave() effectively useless.

Attached is a patch that moves the calls to field_attach_insert() from the entity implementations to field_attach_insert() and field_attach_update().

This seems to be the root-cause for problems like #1140188: Incorrect integer value: 'autocreate' for column 'tid' (default values for autocomplete widgets are not autocreated) .

AttachmentSizeStatusTest resultOperations
field_guarantee_hook_field_presave.patch2.23 KBIdlePASSED: [[SimpleTest]]: [MySQL] 40,349 pass(es).View details | Re-test

Viewing all articles
Browse latest Browse all 292509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>