function OptionsFieldUIAllowedValuesTest::createOptionsField
Same name in other branches
- 10 core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php \Drupal\Tests\options\FunctionalJavascript\OptionsFieldUIAllowedValuesTest::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 OptionsFieldUIAllowedValuesTest::createOptionsField()
- OptionsFieldUIAllowedValuesTest::testOptionsAllowedValues in core/
modules/ options/ tests/ src/ FunctionalJavascript/ OptionsFieldUIAllowedValuesTest.php - Tests option types allowed values.
File
-
core/
modules/ options/ tests/ src/ FunctionalJavascript/ OptionsFieldUIAllowedValuesTest.php, line 255
Class
- OptionsFieldUIAllowedValuesTest
- Tests the Options field allowed values UI functionality.
Namespace
Drupal\Tests\options\FunctionalJavascriptCode
protected function createOptionsField($type) {
// Create a field.
FieldStorageConfig::create([
'field_name' => $this->fieldName,
'entity_type' => 'node',
'type' => $type,
])
->save();
FieldConfig::create([
'field_name' => $this->fieldName,
'entity_type' => 'node',
'bundle' => $this->type,
])
->save();
\Drupal::service('entity_display.repository')->getFormDisplay('node', $this->type)
->setComponent($this->fieldName)
->save();
$this->adminPath = 'admin/structure/types/manage/' . $this->type . '/fields/node.' . $this->type . '.' . $this->fieldName;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.