protected function FieldDefaultsTestBase::setupFieldByType in Field Defaults 8
Helper for field structure.
@TODO: Add support for cardinality
2 calls to FieldDefaultsTestBase::setupFieldByType()
- FieldDefaultsTestBase::setDefaultValues in src/
Tests/ FieldDefaultsTestBase.php - Sets a default value and runs the batch update.
- StringTest::testFieldString in src/
Tests/ StringTest.php - Test updating a boolean.
File
- src/
Tests/ FieldDefaultsTestBase.php, line 155
Class
- FieldDefaultsTestBase
- Class FieldDefaultsTestBase.
Namespace
Drupal\field_defaults\TestsCode
protected function setupFieldByType($type) {
switch ($type) {
case 'string':
// Defaults for boolean per function def.
$structure = '[0][value]';
$value = 'field default';
break;
default:
// Defaults for boolean per function def.
$structure = '[value]';
$value = TRUE;
}
return [
'structure' => $structure,
'value' => $value,
];
}