function FileFieldTestBase::updateFileField

Updates an existing file field with new settings.

4 calls to FileFieldTestBase::updateFileField()
FileFieldPathTest::testUploadPath in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php
Tests the normal formatter display on node display.
FileFieldValidateTest::testFileExtension in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
Tests file extension checking.
FileFieldValidateTest::testFileMaxSize in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldValidateTest.php
Tests the max file size validator.
FileFieldWidgetTest::testWidgetValidation in drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
Tests validation with the Upload button.

File

drupal/core/modules/file/lib/Drupal/file/Tests/FileFieldTestBase.php, line 121
Definition of Drupal\file\Tests\FileFieldTestBase.

Class

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

Namespace

Drupal\file\Tests

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);
  field_update_instance($instance);
  entity_get_form_display($instance['entity_type'], $instance['bundle'], 'default')
    ->setComponent($instance['field_name'], array(
    'settings' => $widget_settings,
  ))
    ->save();
}