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 Answer 1

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.

2
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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