20 February 2014

Change or update field instance programmatically in Drupal 7. For more information check out Field CRUD API in drupal.org.

Source code viewer
  1. // Load field instance, the parameters in right order are: entity type, field name, bundle name.
  2. $instance = field_read_instance('node', 'field_files', 'news');
  3. // Change values
  4. $instance['settings']['description_field'] = 1;
  5. // Save or update field instance.
  6. field_update_instance($instance);
Programming Language: PHP