function CKEditor5ReadOnlyModeTest::createField
Same name and namespace in other branches
- main core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5ReadOnlyModeTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5ReadOnlyModeTest::createField()
Create a field on the page node.
Parameters
string $field_name: The name of the field.
string $field_label: The label for the field.
string $field_type: The type of the field.
string $field_widget: The widget for the field.
2 calls to CKEditor5ReadOnlyModeTest::createField()
- CKEditor5ReadOnlyModeTest::createCkeditorField in core/
modules/ ckeditor5/ tests/ src/ FunctionalJavascript/ CKEditor5ReadOnlyModeTest.php - Create a CKEditor 5 field on the page node.
- CKEditor5ReadOnlyModeTest::setUp in core/
modules/ ckeditor5/ tests/ src/ FunctionalJavascript/ CKEditor5ReadOnlyModeTest.php
File
-
core/
modules/ ckeditor5/ tests/ src/ FunctionalJavascript/ CKEditor5ReadOnlyModeTest.php, line 64
Class
- CKEditor5ReadOnlyModeTest
- Tests read-only mode for CKEditor 5.
Namespace
Drupal\Tests\ckeditor5\FunctionalJavascriptCode
protected function createField(string $field_name, string $field_label, string $field_type, string $field_widget) : void {
$field_storage = FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => 'node',
'type' => $field_type,
'cardinality' => 1,
]);
$field_storage->save();
// Attach an instance of the field to the page content type.
FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => 'page',
'label' => $field_label,
])->save();
$this->container
->get('entity_display.repository')
->getFormDisplay('node', 'page')
->setComponent($field_name, [
'type' => $field_widget,
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.