You are here

public function EntityReference::getString in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php \Drupal\Core\Entity\Plugin\DataType\EntityReference::getString()
  2. 9 core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php \Drupal\Core\Entity\Plugin\DataType\EntityReference::getString()

File

core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php, line 120

Class

EntityReference
Defines an 'entity_reference' data type.

Namespace

Drupal\Core\Entity\Plugin\DataType

Code

public function getString() {
  if ($entity = $this
    ->getValue()) {
    return $entity
      ->label();
  }
  return '';
}