Closed (outdated)
Project:
Drupal core
Version:
9.5.x-dev
Component:
field system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Mar 2012 at 10:17 UTC
Updated:
17 Aug 2023 at 14:42 UTC
Jump to comment: Most recent
Comments
Comment #1
fagoYep, having $instance there would help a lot for doing a proper multiple-value handling for complex field types like addressfield or fieldcollection. That way you could say that form widgets having default values have to be considered empty.
(the default value is part of $instance).
See issues
#1239946: Embedded field collection items with a default value result in new items on save
#1263316: Configurable non-empty value conditions
However, I fear backporting this qualifies as API change as it would change the necessary hook arguments.
Comment #2
johnvJa, that is a pity. For now, using hook_field_presave() is the next best thing.
Comment #3
johnvYou can find my D7 work-around implementation here. IMO it is pretty generic.
Comment #16
smustgrave commentedGoing to close this out as hook_field_is_empty() was removed in https://www.drupal.org/node/2064123, early on in D8.
Thanks!