1.20.x file.test FileTestHelper::updateFileField($name, $type_name, $instance_settings = array(), $widget_settings = array())

Updates an existing file field with new settings.

File

modules/file/tests/file.test, line 225
Tests for file.module.

Class

FileTestHelper
Provides methods specifically for testing File module's field handling.

Code

function updateFileField($name, $type_name, $instance_settings = array(), $widget_settings = array()) {
  $instance = field_info_instance('node', $name, $type_name);
  $instance['settings'] = array_merge($instance['settings'], $instance_settings);
  $instance['widget']['settings'] = array_merge($instance['widget']['settings'], $widget_settings);

  field_update_instance($instance);
}