protected function LingotekFieldOptionsTranslationTest::createOptionsField in Lingotek Translation 3.1.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 4.0.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.0.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.2.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.3.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.4.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.5.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.6.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.7.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
- 3.8.x tests/src/Functional/LingotekFieldOptionsTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekFieldOptionsTranslationTest::createOptionsField()
Helper function to create list field of a given type.
Parameters
string $type: One of 'list_integer', 'list_float' or 'list_string'.
1 call to LingotekFieldOptionsTranslationTest::createOptionsField()
- LingotekFieldOptionsTranslationTest::setUp in tests/
src/ Functional/ LingotekFieldOptionsTranslationTest.php
File
- tests/
src/ Functional/ LingotekFieldOptionsTranslationTest.php, line 115
Class
- LingotekFieldOptionsTranslationTest
- Tests translating a options field.
Namespace
Drupal\Tests\lingotek\FunctionalCode
protected function createOptionsField($type, $bundle, $field_name, $label) {
// Create a field.
FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => 'node',
'type' => $type,
])
->save();
FieldConfig::create([
'field_name' => $field_name,
'label' => $label,
'entity_type' => 'node',
'bundle' => $bundle,
])
->save();
EntityFormDisplay::load('node.' . $bundle . '.default')
->setComponent($field_name)
->save();
$adminPath = 'admin/structure/types/manage/' . $bundle . '/fields/node.' . $bundle . '.' . $field_name . '/storage';
$input_string = "zero|Zero\none|One";
$edit = [
'settings[allowed_values]' => $input_string,
];
$this
->drupalPostForm($adminPath, $edit, t('Save field settings'));
}