1

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

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.

| improve this answer | |
  • 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. – Lester Peabody Jan 15 '13 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 Jan 15 '13 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.