You are here

protected function TestBase::saveWidgetSettings in Double Field 4.x

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/TestBase.php \Drupal\Tests\double_field\Functional\TestBase::saveWidgetSettings()

Saves widget settings.

1 call to TestBase::saveWidgetSettings()
TestBase::setUp in tests/src/Functional/TestBase.php

File

tests/src/Functional/TestBase.php, line 169

Class

TestBase
Tests the creation of text fields.

Namespace

Drupal\Tests\double_field\Functional

Code

protected function saveWidgetSettings(array $settings) : void {

  /** @var \Drupal\Core\Entity\Entity\EntityFormDisplay $form_display */
  $form_display = \Drupal::entityTypeManager()
    ->getStorage('entity_form_display')
    ->load('node.' . $this->contentTypeId . '.default');
  $options = [
    'type' => 'double_field',
    'weight' => 100,
    'settings' => NestedArray::mergeDeep(DoubleField::defaultSettings(), $settings),
    'third_party_settings' => [],
  ];
  $form_display
    ->setComponent($this->fieldName, $options);
  $form_display
    ->save();
}