public function EntityReference::getTarget in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php \Drupal\Core\Entity\Plugin\DataType\EntityReference::getTarget()
Gets the referenced data.
Return value
\Drupal\Core\TypedData\TypedDataInterface|null The referenced typed data object, or NULL if the reference is unset.
Overrides DataReferenceBase::getTarget
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ DataType/ EntityReference.php, line 72 - Contains \Drupal\Core\Entity\Plugin\DataType\EntityReference.
Class
- EntityReference
- Defines an 'entity_reference' data type.
Namespace
Drupal\Core\Entity\Plugin\DataTypeCode
public function getTarget() {
if (!isset($this->target) && isset($this->id)) {
// If we have a valid reference, return the entity's TypedData adapter.
$entity = entity_load($this
->getTargetDefinition()
->getEntityTypeId(), $this->id);
$this->target = isset($entity) ? $entity
->getTypedData() : NULL;
}
return $this->target;
}