protected function TestBase::saveFormatterSettings in Double Field 4.x
Same name and namespace in other branches
- 8.3 tests/src/Functional/TestBase.php \Drupal\Tests\double_field\Functional\TestBase::saveFormatterSettings()
Saves formatter settings.
1 call to TestBase::saveFormatterSettings()
- TestBase::setUp in tests/
src/ Functional/ TestBase.php
File
- tests/
src/ Functional/ TestBase.php, line 189
Class
- TestBase
- Tests the creation of text fields.
Namespace
Drupal\Tests\double_field\FunctionalCode
protected function saveFormatterSettings(string $formatter, array $settings = []) : void {
/** @var \Drupal\Core\Entity\Entity\EntityViewDisplay $view_display */
$view_display = \Drupal::entityTypeManager()
->getStorage('entity_view_display')
->load("node.{$this->contentTypeId}.default");
$options = [
'label' => 'hidden',
'type' => 'double_field_' . $formatter,
'weight' => 100,
'settings' => NestedArray::mergeDeep(BaseFormatter::defaultSettings(), $settings),
'third_party_settings' => [],
];
$view_display
->setComponent($this->fieldName, $options);
$view_display
->save();
}