function EntityReferenceFieldTranslatedReferenceViewTest::createNotTranslatedReferencedEntity

Same name in other branches
  1. 8.9.x core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest::createNotTranslatedReferencedEntity()
  2. 10 core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest::createNotTranslatedReferencedEntity()
  3. 11.x core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php \Drupal\Tests\field\Functional\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest::createNotTranslatedReferencedEntity()

Create the referenced entity.

1 call to EntityReferenceFieldTranslatedReferenceViewTest::createNotTranslatedReferencedEntity()
EntityReferenceFieldTranslatedReferenceViewTest::createContent in core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
Creates a test subject contents, with translation.

File

core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php, line 323

Class

EntityReferenceFieldTranslatedReferenceViewTest
Tests the translation of entity reference field display on nodes.

Namespace

Drupal\Tests\field\Functional\EntityReference

Code

protected function createNotTranslatedReferencedEntity() {
    
    /** @var \Drupal\node\Entity\Node $node */
    $node = \Drupal::entityTypeManager()->getStorage($this->testEntityTypeName)
        ->create([
        'title' => $this->labelOfNotTranslatedReference,
        'type' => $this->referencedType
            ->id(),
        'description' => [
            'value' => $this->randomMachineName(),
            'format' => 'basic_html',
        ],
        'langcode' => $this->baseLangcode,
    ]);
    $node->save();
    return $node;
}

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