function DataReferenceBase::getString

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/DataReferenceBase.php \Drupal\Core\TypedData\DataReferenceBase::getString()
  2. 8.9.x core/lib/Drupal/Core/TypedData/DataReferenceBase.php \Drupal\Core\TypedData\DataReferenceBase::getString()
  3. 10 core/lib/Drupal/Core/TypedData/DataReferenceBase.php \Drupal\Core\TypedData\DataReferenceBase::getString()

Overrides TypedData::getString

1 method overrides DataReferenceBase::getString()
EntityReference::getString in core/lib/Drupal/Core/Entity/Plugin/DataType/EntityReference.php
Returns a string representation of the data.

File

core/lib/Drupal/Core/TypedData/DataReferenceBase.php, line 56

Class

DataReferenceBase
Base class for typed data references.

Namespace

Drupal\Core\TypedData

Code

public function getString() {
    if (!method_exists($this, 'getType')) {
        throw new \BadMethodCallException(get_class($this) . '::getType() not implemented');
    }
    return (string) $this->getType() . ':' . $this->getTargetIdentifier();
}

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