protected function EntityReferenceFieldTranslatedReferenceViewTest::createReferencedEntityWithTranslation in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/field/src/Tests/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php \Drupal\field\Tests\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest::createReferencedEntityWithTranslation()
Create a referenced entity with a translation.
1 call to EntityReferenceFieldTranslatedReferenceViewTest::createReferencedEntityWithTranslation()
- EntityReferenceFieldTranslatedReferenceViewTest::createContent in core/
modules/ field/ src/ Tests/ EntityReference/ EntityReferenceFieldTranslatedReferenceViewTest.php - Creates a test subject contents, with translation.
File
- core/
modules/ field/ src/ Tests/ EntityReference/ EntityReferenceFieldTranslatedReferenceViewTest.php, line 259 - Contains \Drupal\field\Tests\EntityReference\EntityReferenceFieldTranslatedReferenceViewTest.
Class
- EntityReferenceFieldTranslatedReferenceViewTest
- Tests the translation of entity reference field display on nodes.
Namespace
Drupal\field\Tests\EntityReferenceCode
protected function createReferencedEntityWithTranslation() {
/** @var \Drupal\node\Entity\Node $node */
$node = entity_create($this->testEntityTypeName, array(
'title' => $this->originalLabel,
'type' => $this->referencedType
->id(),
'description' => array(
'value' => $this
->randomMachineName(),
'format' => 'basic_html',
),
'langcode' => $this->baseLangcode,
));
$node
->save();
$node
->addTranslation($this->translateToLangcode, array(
'title' => $this->translatedLabel,
));
$node
->save();
return $node;
}