protected function LinkStubReplicationTest::createLinkField in Replication 8.2
Same name and namespace in other branches
- 8 tests/src/Kernel/LinkStubReplicationTest.php \Drupal\Tests\replication\Kernel\LinkStubReplicationTest::createLinkField()
Create link field for entity type.
Parameters
string $entity_type: Entity type.
string $bundle: Entity type bundle.
$field_name: Name of the link field to create.
1 call to LinkStubReplicationTest::createLinkField()
- LinkStubReplicationTest::setUp in tests/
src/ Kernel/ LinkStubReplicationTest.php
File
- tests/
src/ Kernel/ LinkStubReplicationTest.php, line 206
Class
- LinkStubReplicationTest
- Tests link stub replication.
Namespace
Drupal\Tests\replication\KernelCode
protected function createLinkField($entity_type, $bundle, $field_name) {
FieldStorageConfig::create([
'field_name' => $field_name,
'entity_type' => $entity_type,
'type' => 'link',
'cardinality' => 2,
'translatable' => FALSE,
])
->save();
FieldConfig::create([
'entity_type' => $entity_type,
'field_name' => $field_name,
'bundle' => $bundle,
'label' => 'Test link-field',
'widget' => [
'type' => 'link',
'weight' => 0,
],
])
->save();
}