function ContentTranslationSyncImageTest::setupTestFields

Same name in other branches
  1. 8.9.x core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSyncImageTest::setupTestFields()
  2. 10 core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSyncImageTest::setupTestFields()
  3. 11.x core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php \Drupal\Tests\content_translation\Functional\ContentTranslationSyncImageTest::setupTestFields()

Creates the test image field.

Overrides ContentTranslationTestBase::setupTestFields

File

core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php, line 66

Class

ContentTranslationSyncImageTest
Tests the field synchronization behavior for the image field.

Namespace

Drupal\Tests\content_translation\Functional

Code

protected function setupTestFields() {
    $this->fieldName = 'field_test_et_ui_image';
    $this->cardinality = 3;
    FieldStorageConfig::create([
        'field_name' => $this->fieldName,
        'entity_type' => $this->entityTypeId,
        'type' => 'image',
        'cardinality' => $this->cardinality,
    ])
        ->save();
    FieldConfig::create([
        'entity_type' => $this->entityTypeId,
        'field_name' => $this->fieldName,
        'bundle' => $this->entityTypeId,
        'label' => 'Test translatable image field',
        'third_party_settings' => [
            'content_translation' => [
                'translation_sync' => [
                    'file' => FALSE,
                    'alt' => 'alt',
                    'title' => 'title',
                ],
            ],
        ],
    ])
        ->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.