protected function TestBase::saveFieldSettings 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::saveFieldSettings()
Saves field settings.
3 calls to TestBase::saveFieldSettings()
- FieldTypeTest::testFieldSettings in tests/
src/ Functional/ FieldTypeTest.php - Test field settings.
- FieldTypeTest::testFieldStorageSettings in tests/
src/ Functional/ FieldTypeTest.php - Test field storage settings.
- FieldTypeTest::testRequiredOptions in tests/
src/ Functional/ FieldTypeTest.php - Test required options.
File
- tests/
src/ Functional/ TestBase.php, line 142
Class
- TestBase
- Tests the creation of text fields.
Namespace
Drupal\Tests\double_field\FunctionalCode
protected function saveFieldSettings(array $settings) : void {
$persisted_settings = $this->field
->getSettings();
// Override allowed values instead of merging.
foreach ([
'first',
'second',
] as $subfield) {
if (isset($persisted_settings[$subfield]['allowed_values'], $settings[$subfield]['allowed_values'])) {
unset($persisted_settings[$subfield]['allowed_values']);
}
}
$this->field
->setSettings(NestedArray::mergeDeep($persisted_settings, $settings));
$this->field
->save();
}