You are here

public function FileFieldSourcesTestBase::updateFilefieldSourcesSettings in FileField Sources 8

Update file field sources settings.

Parameters

string $source_key: Wrapper, defined by each source.

string $key: Key, defined by each source.

mixed $value: Value to set.

2 calls to FileFieldSourcesTestBase::updateFilefieldSourcesSettings()
AttachSourceTest::testCopyFileFromAbsolutePath in tests/src/Functional/AttachSourceTest.php
Tests copy file from absolute path.
ReferenceSourceTest::testAutocompletion in tests/src/Functional/ReferenceSourceTest.php
Test autocompletion.

File

tests/src/Functional/FileFieldSourcesTestBase.php, line 214

Class

FileFieldSourcesTestBase
Base class for File Field Sources test cases.

Namespace

Drupal\Tests\filefield_sources\Functional

Code

public function updateFilefieldSourcesSettings($source_key, $key, $value) {
  $manage_display = 'admin/structure/types/manage/' . $this->typeName . '/form-display';
  $this
    ->drupalGet($manage_display);

  // Click on the widget settings button to open the widget settings form.
  $this
    ->drupalPostForm(NULL, [], $this->fieldName . "_settings_edit");

  // Update settings.
  $name = 'fields[' . $this->fieldName . '][settings_edit_form][third_party_settings][filefield_sources][filefield_sources]' . "[{$source_key}][{$key}]";
  $edit = [
    $name => $value,
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this->fieldName . '_plugin_settings_update');

  // Save the form to save the third party settings.
  $this
    ->drupalPostForm(NULL, [], t('Save'));
}