How do you update the default value for a field programmatically? I know you can get the field instance info by calling field_info_instance, but how do you update that info?
1 Answer
The field_update_instance()
function is the standard method
Updates an instance of a field.
You can take the array returned by field_info_instance()
, make your changes, then pass it back to field_update_instance()
and the changes will be saved.
-
I literally searched for an hour to find that function, assuming such a thing existed. Apparently I just suck at searching today. Must be a carryover from Monday. Thanks Clive. Commented Jan 15, 2013 at 20:20
-
I remember this (and
field_update_field()
) taking me ages to find too. They seem to be named intuitively enough but my brain didn't seem to agree when searching!– Clive ♦Commented Jan 15, 2013 at 20:24